Delen via


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)

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.

public static Microsoft.ML.TorchSharp.Roberta.QATrainer QuestionAnswer (this Microsoft.ML.MulticlassClassificationCatalog.MulticlassClassificationTrainers catalog, Microsoft.ML.TorchSharp.Roberta.QATrainer.Options options);
static member QuestionAnswer : Microsoft.ML.MulticlassClassificationCatalog.MulticlassClassificationTrainers * Microsoft.ML.TorchSharp.Roberta.QATrainer.Options -> Microsoft.ML.TorchSharp.Roberta.QATrainer
<Extension()>
Public Function QuestionAnswer (catalog As MulticlassClassificationCatalog.MulticlassClassificationTrainers, options As QATrainer.Options) As QATrainer

Parameters

options
QATrainer.Options

The options for QA.

Returns

Applies to

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.

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);
static member QuestionAnswer : Microsoft.ML.MulticlassClassificationCatalog.MulticlassClassificationTrainers * string * string * string * string * string * string * int * int * int * Microsoft.ML.TorchSharp.NasBert.BertArchitecture * Microsoft.ML.IDataView -> Microsoft.ML.TorchSharp.Roberta.QATrainer
<Extension()>
Public Function QuestionAnswer (catalog As MulticlassClassificationCatalog.MulticlassClassificationTrainers, Optional contextColumnName As String = "Context", Optional questionColumnName As String = "Question", Optional trainingAnswerColumnName As String = "TrainingAnswer", Optional answerIndexColumnName As String = "AnswerIndex", Optional predictedAnswerColumnName As String = "Answer", Optional scoreColumnName As String = "Score", Optional topK As Integer = 3, Optional batchSize As Integer = 4, Optional maxEpochs As Integer = 10, Optional architecture As BertArchitecture = Microsoft.ML.TorchSharp.NasBert.BertArchitecture.Roberta, Optional validationSet As IDataView = Nothing) As QATrainer

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