Method ExportAsSharegpt
- Namespace
- LMKit.Finetuning
- Assembly
- LM-Kit.NET.dll
ExportAsSharegpt(string, bool, string, CancellationToken)
Exports the dataset as a ShareGPT-compatible JSON file.
public void ExportAsSharegpt(string outputFilePath, bool overwrite = false, string imagePrefix = "sample", CancellationToken cancellationToken = default)
Parameters
outputFilePathstringThe full path where the dataset file should be written.
overwriteboolIf true, overwrites any existing file at
outputFilePath. Otherwise, throws if the file exists.imagePrefixstringThe prefix to use for images (if any) embedded in chat samples. Defaults to
"sample".cancellationTokenCancellationTokenA token that may be used to cancel the export operation.
Examples
var dataset = new MyCustomDataset();
dataset.AddSample(new ChatTrainingSample(chatHistory));
dataset.ExportAsSharegpt("training.json", overwrite: true);