35 references to Parent
Microsoft.ML.TorchSharp (35)
NasBert\NasBertTrainer.cs (28)
189
Optimizer = BaseOptimizer.GetOptimizer(
Parent
.BertOptions, parameters);
193
max_lr:
Parent
.BertOptions.LearningRate[0],
194
total_steps: ((TrainingRowCount /
Parent
.Option.BatchSize) + 1) *
Parent
.Option.MaxEpoch,
195
pct_start:
Parent
.BertOptions.WarmupRatio,
197
div_factor: 1.0 /
Parent
.Option.StartLearningRateRatio,
198
final_div_factor:
Parent
.Option.StartLearningRateRatio /
Parent
.Option.FinalLearningRateRatio);
207
if (
Parent
.BertOptions.TaskType == BertTaskType.NamedEntityRecognition)
208
model = new NerModel(
Parent
.BertOptions, tokenizerModel.PadIndex, tokenizerModel.SymbolsCount,
Parent
.Option.NumberOfClasses);
210
model = new ModelForPrediction(
Parent
.BertOptions, tokenizerModel.PadIndex, tokenizerModel.SymbolsCount,
Parent
.Option.NumberOfClasses);
218
if (
Parent
.BertOptions.Sentence2ColumnName != default)
219
return input.GetRowCursor(input.Schema[
Parent
.BertOptions.Sentence1ColumnName], input.Schema[
Parent
.BertOptions.Sentence2ColumnName], input.Schema[
Parent
.Option.LabelColumnName]);
221
return input.GetRowCursor(input.Schema[
Parent
.BertOptions.Sentence1ColumnName], input.Schema[
Parent
.Option.LabelColumnName]);
226
Sentence1Getter = cursor.GetGetter<ReadOnlyMemory<char>>(input.Schema[
Parent
.BertOptions.Sentence1ColumnName]);
227
Sentence2Getter =
Parent
.BertOptions.Sentence2ColumnName != default ? cursor.GetGetter<ReadOnlyMemory<char>>(input.Schema[
Parent
.BertOptions.Sentence2ColumnName]) : default;
271
if (
Parent
.BertOptions.TaskType == BertTaskType.NamedEntityRecognition)
294
if (
Parent
.BertOptions.TaskType == BertTaskType.TextClassification)
295
loss = torch.nn.CrossEntropyLoss(reduction:
Parent
.BertOptions.Reduction).forward(logits, targetsTensor);
296
else if (
Parent
.BertOptions.TaskType == BertTaskType.NamedEntityRecognition)
300
loss = torch.nn.CrossEntropyLoss(reduction:
Parent
.BertOptions.Reduction).forward(logits, targetsTensor);
304
loss = torch.nn.MSELoss(reduction:
Parent
.BertOptions.Reduction).forward(logits.squeeze(), targetsTensor);
NasBert\NerTrainer.cs (3)
216
input.Schema[
Parent
.Option.LabelColumnName].GetKeyValues(ref keys);
217
var labelCol = input.GetColumn<VBuffer<uint>>(
Parent
.Option.LabelColumnName);
225
Parent
.Option.NumberOfClasses = keys.Length + 1;
NasBert\SentenceSimilarityTrainer.cs (2)
148
var labelCol = input.GetColumn<float>(
Parent
.Option.LabelColumnName);
157
Parent
.Option.NumberOfClasses = 1;
NasBert\TextClassificationTrainer.cs (2)
150
var labelCol = input.GetColumn<uint>(
Parent
.Option.LabelColumnName);
160
Parent
.Option.NumberOfClasses = uniqueLabels.Count;