-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add SentenceSimilarity sweepable estimator in AutoML (#6445)
- Loading branch information
1 parent
42788c4
commit b1cb564
Showing
6 changed files
with
80 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/Microsoft.ML.AutoML/CodeGen/sentence_similarity_search_space.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"$schema": "./search-space-schema.json#", | ||
"name": "sentence_similarity_option", | ||
"search_space": [ | ||
{ | ||
"name": "LabelColumnName", | ||
"type": "string", | ||
"default": "Label" | ||
}, | ||
{ | ||
"name": "Sentence1ColumnName", | ||
"type": "string", | ||
"default": "Sentence1" | ||
}, | ||
{ | ||
"name": "Sentence2ColumnName", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "ScoreColumnName", | ||
"type": "string", | ||
"default": "Score" | ||
}, | ||
{ | ||
"name": "BatchSize", | ||
"type": "integer", | ||
"default": 32 | ||
}, | ||
{ | ||
"name": "MaxEpochs", | ||
"type": "integer", | ||
"default": 10 | ||
}, | ||
{ | ||
"name": "Architecture", | ||
"type": "bertArchitecture", | ||
"default": "BertArchitecture.Roberta" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/Microsoft.ML.AutoML/SweepableEstimator/Estimators/SentenceSimilarity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 System; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using System.Text; | ||
using Microsoft.ML.TorchSharp; | ||
|
||
namespace Microsoft.ML.AutoML.CodeGen | ||
{ | ||
internal partial class SentenceSimilarityRegression | ||
{ | ||
public override IEstimator<ITransformer> BuildFromOption(MLContext context, SentenceSimilarityOption param) | ||
{ | ||
return context.Regression.Trainers.SentenceSimilarity( | ||
labelColumnName: param.LabelColumnName, | ||
sentence1ColumnName: param.Sentence1ColumnName, | ||
scoreColumnName: param.ScoreColumnName, | ||
sentence2ColumnName: param.Sentence2ColumnName, | ||
batchSize: param.BatchSize, | ||
maxEpochs: param.MaxEpochs, | ||
architecture: param.Architecture); | ||
} | ||
} | ||
} |