1 write to Parent
Microsoft.ML.TorchSharp (1)
Roberta\QATrainer.cs (1)
194Parent = parent;
29 references to Parent
Microsoft.ML.TorchSharp (29)
Roberta\QATrainer.cs (29)
201Device = TorchUtils.InitializeDevice(Parent.Host); 204Model = new RobertaModelForQA(Parent.Option); 209Device = TorchUtils.InitializeDevice(Parent.Host); 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); 245var destDir = Path.Combine(((IHostEnvironmentInternal)Parent.Host).TempFilePath, "mlnet"); 253using (var ch = (Parent.Host as IHostEnvironment).Start("Ensuring model file is present.")) 255var ensureModel = ResourceManagerUtils.Instance.EnsureResourceAsync(Parent.Host, ch, ModelUrl, destFileName, destDir, timeout); 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)