Method AddSample
- Namespace
- LMKit.Translation.Training
- Assembly
- LM-Kit.NET.dll
AddSample(string, Language)
Adds a training sample from raw text, using BestModality.
public void AddSample(string content, Language language)
Parameters
contentstringThe textual content whose language is labeled.
languageLanguageThe expected language label for this sample.
Examples
dataset.AddSample("今日はいい天気ですね。", TextGeneration.Language.Japanese);
Remarks
Wraps the text into an Attachment and forwards to AddSample(Attachment, Language, InferenceModality).
AddSample(Attachment, Language, InferenceModality)
Adds a training sample with an explicit InferenceModality.
public void AddSample(Attachment content, Language language, InferenceModality modality)
Parameters
contentAttachmentThe input attachment (text, image, or multimodal) to label.
languageLanguageThe expected language label for this sample.
modalityInferenceModalityThe preferred inference modality for prompt generation (e.g., Text, Vision, Multimodal, or BestModality).
Examples
var img = /* image attachment with embedded text */;
dataset.AddSample(img, TextGeneration.Language.English, InferenceModality.Multimodal);
Remarks
This method calls CreateLanguageDetectionTrainingSample(Prompt, Language, InferenceModality, out InferenceModality)
to synthesize a chat-based training example and resolves the effective
inferenceModality.
The result is wrapped in ChatTrainingSample and added to the dataset.
If EnableModalityAugmentation is true and
modality is Multimodal or
BestModality, a complementary modality sample may be
added automatically, subject to content capabilities:
-
Resolved
inferenceModality == Textandcontent.SupportsRasterization⇒ add a Vision sample. -
Resolved
inferenceModality == Vision,content.HasText, andParsingUtils.HasMinimumLetters(content.GetText(), ModalityUtils.MinTextLettersForTextModality)⇒ add a Text sample.