Table of Contents

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 string

The full path where the dataset file should be written.

overwrite bool

If true, overwrites any existing file at outputFilePath. Otherwise, throws if the file exists.

imagePrefix string

The prefix to use for images (if any) embedded in chat samples. Defaults to "sample".

cancellationToken CancellationToken

A 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);