TorchSharpCatalog.QuestionAnswer Method

Definition

Overloads

QuestionAnswer(MulticlassClassificationCatalog+MulticlassClassificationTrainers, QATrainer+Options)

Fine tune a ROBERTA model for Question and Answer. The limit for any sentence is 512 tokens. Each word typically will map to a single token, and we automatically add 2 specical tokens (a start token and a separator token) so in general this limit will be 510 words for all sentences.

QuestionAnswer(MulticlassClassificationCatalog+MulticlassClassificationTrainers, String, String, String, String, String, String, Int32, Int32, Int32, BertArchitecture, IDataView)

Fine tune a ROBERTA model for Question and Answer. The limit for any sentence is 512 tokens. Each word typically will map to a single token, and we automatically add 2 specical tokens (a start token and a separator token) so in general this limit will be 510 words for all sentences.

QuestionAnswer(MulticlassClassificationCatalog+MulticlassClassificationTrainers, QATrainer+Options)

Source:
TorchSharpCatalog.cs
Source:
TorchSharpCatalog.cs
Source:
TorchSharpCatalog.cs

Fine tune a ROBERTA model for Question and Answer. The limit for any sentence is 512 tokens. Each word typically will map to a single token, and we automatically add 2 specical tokens (a start token and a separator token) so in general this limit will be 510 words for all sentences.

C#
public static Microsoft.ML.TorchSharp.Roberta.QATrainer QuestionAnswer(this Microsoft.ML.MulticlassClassificationCatalog.MulticlassClassificationTrainers catalog, Microsoft.ML.TorchSharp.Roberta.QATrainer.Options options);

Parameters

options
QATrainer.Options

The options for QA.

Returns

Applies to

ML.NET Preview and other versions
Product Versions
ML.NET 3.0.0, 4.0.0, Preview

QuestionAnswer(MulticlassClassificationCatalog+MulticlassClassificationTrainers, String, String, String, String, String, String, Int32, Int32, Int32, BertArchitecture, IDataView)

Source:
TorchSharpCatalog.cs
Source:
TorchSharpCatalog.cs
Source:
TorchSharpCatalog.cs

Fine tune a ROBERTA model for Question and Answer. The limit for any sentence is 512 tokens. Each word typically will map to a single token, and we automatically add 2 specical tokens (a start token and a separator token) so in general this limit will be 510 words for all sentences.

C#
public static Microsoft.ML.TorchSharp.Roberta.QATrainer QuestionAnswer(this Microsoft.ML.MulticlassClassificationCatalog.MulticlassClassificationTrainers catalog, string contextColumnName = "Context", string questionColumnName = "Question", string trainingAnswerColumnName = "TrainingAnswer", string answerIndexColumnName = "AnswerIndex", string predictedAnswerColumnName = "Answer", string scoreColumnName = "Score", int topK = 3, int batchSize = 4, int maxEpochs = 10, Microsoft.ML.TorchSharp.NasBert.BertArchitecture architecture = Microsoft.ML.TorchSharp.NasBert.BertArchitecture.Roberta, Microsoft.ML.IDataView validationSet = default);

Parameters

contextColumnName
String

The context for the question.

questionColumnName
String

The question being asked.

trainingAnswerColumnName
String

The answer used to train the model.

answerIndexColumnName
String

The starting character index of that answer in the context.

predictedAnswerColumnName
String

The answer predicted by the model during inferencing.

scoreColumnName
String

The score of the predicted answers.

topK
Int32

How many top results you want back for a given question.

batchSize
Int32

Number of rows in the batch.

maxEpochs
Int32

Maximum number of times to loop through your training set.

architecture
BertArchitecture

Architecture for the model. Defaults to Roberta.

validationSet
IDataView

The validation set used while training to improve model quality.

Returns

Applies to

ML.NET Preview and other versions
Product Versions
ML.NET 3.0.0, 4.0.0, Preview