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
outputFilePath
stringThe full path where the dataset file should be written.
overwrite
boolIf true, overwrites any existing file at
outputFilePath
. Otherwise, throws if the file exists.imagePrefix
stringThe prefix to use for images (if any) embedded in chat samples. Defaults to
"sample"
.cancellationToken
CancellationTokenA 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);