Skip to content

Commit e7982f8

Browse files
revert tests
1 parent a35f7e2 commit e7982f8

File tree

2 files changed

+3
-96
lines changed

2 files changed

+3
-96
lines changed

test/Microsoft.ML.AutoML.Tests/AutoMLExperimentTests.cs

Lines changed: 3 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
using Microsoft.Data.Analysis;
1515
using Microsoft.Extensions.DependencyInjection;
1616
using Microsoft.ML.AutoML.CodeGen;
17-
using Microsoft.ML.Data;
1817
using Microsoft.ML.Runtime;
1918
using Microsoft.ML.TestFramework;
2019
using Microsoft.ML.TestFramework.Attributes;
21-
using Microsoft.ML.TorchSharp;
2220
using Xunit;
2321
using Xunit.Abstractions;
2422

@@ -239,14 +237,13 @@ public async Task AutoMLExperiment_UCI_Adult_CV_5_Test()
239237
var experiment = context.Auto().CreateExperiment();
240238
var pipeline = context.Auto().Featurizer(data, "_Features_", excludeColumns: new[] { DatasetUtil.UciAdultLabel })
241239
.Append(context.Auto().BinaryClassification(DatasetUtil.UciAdultLabel, "_Features_", useLgbm: false, useSdcaLogisticRegression: false, useLbfgsLogisticRegression: false));
242-
var cts = new CancellationTokenSource();
243-
cts.CancelAfter(50000);
240+
244241
experiment.SetDataset(data, 5)
245242
.SetBinaryClassificationMetric(BinaryClassificationMetric.AreaUnderRocCurve, DatasetUtil.UciAdultLabel)
246243
.SetPipeline(pipeline)
247-
.SetTrainingTimeInSeconds(100);
244+
.SetTrainingTimeInSeconds(10);
248245

249-
var result = await experiment.RunAsync(cts.Token);
246+
var result = await experiment.RunAsync();
250247
result.Metric.Should().BeGreaterThan(0.8);
251248
}
252249

@@ -363,88 +360,6 @@ public void AutoMLExperiment_should_use_seed_from_context_if_provided()
363360
settings = experiment.ServiceCollection.BuildServiceProvider().GetRequiredService<AutoMLExperiment.AutoMLExperimentSettings>();
364361
settings.Seed.Should().Be(1);
365362
}
366-
367-
[Fact]
368-
public async Task AutoMLExperiment_should_cancel_text_classification()
369-
{
370-
var context = new MLContext(1);
371-
context.Log += (o, e) =>
372-
{
373-
if (e.Message.Contains("AutoMLExperiment") || e.Message.Contains("NasBertTrainer"))
374-
{
375-
this.Output.WriteLine(e.RawMessage);
376-
}
377-
};
378-
var dataView = context.Data.LoadFromEnumerable(
379-
new List<TestSingleSentenceData>(new TestSingleSentenceData[] {
380-
new TestSingleSentenceData()
381-
{ // Testing longer than 512 words.
382-
Sentence1 = "ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community . ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community . ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community . ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .ultimately feels as flat as the scruffy sands of its titular community .",
383-
Sentiment = "Negative"
384-
},
385-
new TestSingleSentenceData()
386-
{
387-
Sentence1 = "with a sharp script and strong performances",
388-
Sentiment = "Positive"
389-
},
390-
new TestSingleSentenceData()
391-
{
392-
Sentence1 = "that director m. night shyamalan can weave an eerie spell and",
393-
Sentiment = "Positive"
394-
},
395-
new TestSingleSentenceData()
396-
{
397-
Sentence1 = "comfortable",
398-
Sentiment = "Positive"
399-
},
400-
new TestSingleSentenceData()
401-
{
402-
Sentence1 = "does have its charms .",
403-
Sentiment = "Positive"
404-
},
405-
new TestSingleSentenceData()
406-
{
407-
Sentence1 = "banal as the telling",
408-
Sentiment = "Negative"
409-
},
410-
new TestSingleSentenceData()
411-
{
412-
Sentence1 = "faithful without being forceful , sad without being shrill , `` a walk to remember '' succeeds through sincerity .",
413-
Sentiment = "Negative"
414-
},
415-
new TestSingleSentenceData()
416-
{
417-
Sentence1 = "leguizamo 's best movie work so far",
418-
Sentiment = "Negative"
419-
}
420-
}));
421-
422-
var experiment = context.Auto().CreateExperiment();
423-
var chain = new EstimatorChain<ITransformer>();
424-
var pipeline = chain.Append(context.Transforms.Conversion.MapValueToKey("Label", "Sentiment"))
425-
.Append(SweepableEstimatorFactory.CreateTextClassificationMulti(new TextClassificationOption
426-
{
427-
MaxEpochs = 100,
428-
LabelColumnName = "Label",
429-
}))
430-
.Append(SweepableEstimatorFactory.CreateMapKeyToValue(new MapKeyToValueOption
431-
{
432-
InputColumnName = "PredictedLabel",
433-
OutputColumnName = "PredictedLabel",
434-
}));
435-
experiment.SetPipeline(pipeline)
436-
.SetDataset(dataView, dataView)
437-
.SetMulticlassClassificationMetric(MulticlassClassificationMetric.MacroAccuracy, "Label")
438-
.SetMaxModelToExplore(1);
439-
var cts = new CancellationTokenSource();
440-
cts.CancelAfter(15_000);
441-
await experiment.RunAsync(cts.Token);
442-
}
443-
}
444-
class TestSingleSentenceData
445-
{
446-
public string Sentence1;
447-
public string Sentiment;
448363
}
449364

450365
class DummyTrialRunner : ITrialRunner

test/Microsoft.ML.AutoML.Tests/Microsoft.ML.AutoML.Tests.csproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<ProjectReference Include="..\..\src\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
1010
<ProjectReference Include="..\..\src\Microsoft.ML.SearchSpace\Microsoft.ML.SearchSpace.csproj" />
1111
<ProjectReference Include="..\..\src\Microsoft.ML.Transforms\Microsoft.ML.Transforms.csproj" />
12-
<ProjectReference Include="..\..\src\Microsoft.ML.TorchSharp\Microsoft.ML.TorchSharp.csproj" Condition="'$(TargetArchitecture)' == 'x64'" />
1312
<ProjectReference Include="..\Microsoft.ML.TestFramework\Microsoft.ML.TestFramework.csproj" />
1413
</ItemGroup>
1514

@@ -52,11 +51,4 @@
5251
</Content>
5352
</ItemGroup>
5453

55-
<ItemGroup Condition="'$(TargetArchitecture)' == 'x64'">
56-
<PackageReference Include="libtorch-cpu-win-x64" Version="$(LibTorchVersion)" Condition="$([MSBuild]::IsOSPlatform('Windows')) AND '$(TargetArchitecture)' == 'x64'" />
57-
<!-- <PackageReference Include="TorchSharp-cuda-windows" Version="0.96.8" Condition="$([MSBuild]::IsOSPlatform('Windows'))" /> -->
58-
<PackageReference Include="libtorch-cpu-linux-x64" Version="$(LibTorchVersion)" Condition="$([MSBuild]::IsOSPlatform('Linux')) AND '$(TargetArchitecture)' == 'x64'" />
59-
<PackageReference Include="libtorch-cpu-osx-x64" Version="$(LibTorchVersion)" Condition="$([MSBuild]::IsOSPlatform('OSX')) AND '$(TargetArchitecture)' == 'x64'" />
60-
</ItemGroup>
61-
6254
</Project>

0 commit comments

Comments
 (0)