Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/Microsoft.ML.AutoML/CodeGen/QuestionAnswering.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.ML.TorchSharp;
using Microsoft.ML.TorchSharp.NasBert;
using Microsoft.ML.TorchSharp.Roberta;

namespace Microsoft.ML.AutoML.CodeGen
{
internal class QuestionAnsweringMulti
{
public IEstimator<ITransformer> BuildFromOption(MLContext context, QATrainer.Options param)
{
return context.MulticlassClassification.Trainers.QuestionAnswer(
contextColumnName: param.ContextColumnName,
questionColumnName: param.QuestionColumnName,
trainingAnswerColumnName: param.TrainingAnswerColumnName,
answerIndexColumnName: param.AnswerIndexStartColumnName,
predictedAnswerColumnName: param.PredictedAnswerColumnName,
scoreColumnName: param.ScoreColumnName,
batchSize: param.BatchSize,
maxEpochs: param.MaxEpoch,
topK: param.TopKAnswers,
architecture: BertArchitecture.Roberta);
}
}
}
3 changes: 2 additions & 1 deletion src/Microsoft.ML.AutoML/CodeGen/estimator-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"ForecastBySsa",
"TextClassifcation",
"SentenceSimilarity",
"ObjectDetection"
"ObjectDetection",
"QuestionAnswering"
]
},
"nugetDependencies": {
Expand Down
51 changes: 51 additions & 0 deletions src/Microsoft.ML.AutoML/CodeGen/question-answering.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "./search-space-schema.json#",
"name": "question_answering _option",
"search_space": [
{
"name": "ContextColumnName",
"type": "string",
"default": "Context"
},
{
"name": " QuestionColumnName",
"type": "string",
"default": "Question"
},
{
"name": "TrainingAnswerColumnName",
"type": "string",
"default": "TrainingAnswer"
},
{
"name": "AnswerIndexStartColumnName",
"type": "string",
"default": "AnswerStart"
},
{
"name": "ScoreColumnName",
"type": "string",
"default": "Score"
},
{
"name": "predictedAnswerColumnName",
"type": "string",
"default": "Answer"
},
{
"name": "BatchSize",
"type": "integer",
"default": 4
},
{
"name": "MaxEpochs",
"type": "integer",
"default": 10
},
{
"name": "Architecture",
"type": "bertArchitecture",
"default": "BertArchitecture.Roberta"
}
]
}
3 changes: 2 additions & 1 deletion src/Microsoft.ML.AutoML/CodeGen/search-space-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@
"dnn_featurizer_image_option",
"text_classification_option",
"sentence_similarity_option",
"object_detection_option"
"object_detection_option",
"question_answering _option"
]
},
"option_name": {
Expand Down
7 changes: 7 additions & 0 deletions src/Microsoft.ML.AutoML/CodeGen/trainer-estimators.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,13 @@
"usingStatements": [ "Microsoft.ML", "Microsoft.ML.Trainers", "Microsoft.ML.TorchSharp" ],
"searchOption": "object_detection_option"
},
{
"functionName": "QuestionAnswering",
"estimatorTypes": [ "MultiClassification" ],
"nugetDependencies": [ "Microsoft.ML", "Microsoft.ML.TorchSharp" ],
"usingStatements": [ "Microsoft.ML", "Microsoft.ML.Trainers", "Microsoft.ML.TorchSharp" ],
"searchOption": "question_answering_option"
},
{
"functionName": "ForecastBySsa",
"estimatorTypes": [ "Forecasting" ],
Expand Down