1 write to Option
Microsoft.ML.TorchSharp (1)
Roberta\QATrainer.cs (1)
113Option = options;
42 references to Option
Microsoft.ML.TorchSharp (42)
Roberta\QATrainer.cs (42)
163for (int i = 0; i < Option.MaxEpoch; i++) 173transformer = new QATransformer(Host, Option, trainer.Model); 204Model = new RobertaModelForQA(Parent.Option); 219Optimizer = BaseOptimizer.GetOptimizer(Parent.Option, parameters); 222max_lr: Parent.Option.LearningRate[0], 223total_steps: ((RowCount / Parent.Option.BatchSize) + 1) * Parent.Option.MaxEpoch, 224pct_start: Parent.Option.WarmupRatio, 226div_factor: 1.0 / Parent.Option.StartLearningRateRatio, 227final_div_factor: Parent.Option.StartLearningRateRatio / Parent.Option.FinalLearningRateRatio); 232var labelCol = input.GetColumn<int>(Parent.Option.AnswerIndexStartColumnName); 272DataViewRowCursor cursor = input.GetRowCursor(input.Schema[Parent.Option.ContextColumnName], input.Schema[Parent.Option.QuestionColumnName], input.Schema[Parent.Option.TrainingAnswerColumnName], input.Schema[Parent.Option.AnswerIndexStartColumnName]); 274var contextGetter = cursor.GetGetter<ReadOnlyMemory<char>>(input.Schema[Parent.Option.ContextColumnName]); 275var questionGetter = cursor.GetGetter<ReadOnlyMemory<char>>(input.Schema[Parent.Option.QuestionColumnName]); 276var answerGetter = cursor.GetGetter<ReadOnlyMemory<char>>(input.Schema[Parent.Option.TrainingAnswerColumnName]); 277var answerIndexGetter = cursor.GetGetter<int>(input.Schema[Parent.Option.AnswerIndexStartColumnName]); 282List<Tensor> inputTensors = new List<Tensor>(Parent.Option.BatchSize); 283List<Tensor> targetTensors = new List<Tensor>(Parent.Option.BatchSize); 323for (int i = 0; i < Parent.Option.BatchSize && cursorValid; i++) 364torch.Tensor lossStart = torch.nn.CrossEntropyLoss(reduction: Parent.Option.Reduction).forward(startLogits, startTargets); 365torch.Tensor lossEnd = torch.nn.CrossEntropyLoss(reduction: Parent.Option.Reduction).forward(endLogits, endTargets); 375if (Updates % Parent.Option.LogEveryNStep == 0) 519outColumns[Option.PredictedAnswerColumnName] = new SchemaShape.Column(Option.PredictedAnswerColumnName, SchemaShape.Column.VectorKind.VariableVector, 522outColumns[Option.ScoreColumnName] = new SchemaShape.Column(Option.ScoreColumnName, SchemaShape.Column.VectorKind.VariableVector, 531if (!inputSchema.TryFindColumn(Option.ContextColumnName, out var contextCol)) 532throw Host.ExceptSchemaMismatch(nameof(inputSchema), "Context", Option.ContextColumnName); 534throw Host.ExceptSchemaMismatch(nameof(inputSchema), "Context", Option.ContextColumnName, 537if (!inputSchema.TryFindColumn(Option.QuestionColumnName, out var questionCol)) 538throw Host.ExceptSchemaMismatch(nameof(inputSchema), "Question", Option.QuestionColumnName); 540throw Host.ExceptSchemaMismatch(nameof(inputSchema), "Question", Option.QuestionColumnName, 543if (!inputSchema.TryFindColumn(Option.TrainingAnswerColumnName, out var answerCol)) 544throw Host.ExceptSchemaMismatch(nameof(inputSchema), "TrainingAnswer", Option.TrainingAnswerColumnName); 546throw Host.ExceptSchemaMismatch(nameof(inputSchema), "TrainingAnswer", Option.TrainingAnswerColumnName, 549if (!inputSchema.TryFindColumn(Option.AnswerIndexStartColumnName, out var answerIndexCol)) 550throw Host.ExceptSchemaMismatch(nameof(inputSchema), "AnswerIndex", Option.AnswerIndexStartColumnName); 552throw Host.ExceptSchemaMismatch(nameof(inputSchema), "AnswerIndex", Option.AnswerIndexStartColumnName,