diff --git a/build/ci/job-template.yml b/build/ci/job-template.yml index 66e79a37c8..f185606033 100644 --- a/build/ci/job-template.yml +++ b/build/ci/job-template.yml @@ -121,7 +121,7 @@ jobs: - ${{ if eq(parameters.nightlyBuild, 'false') }}: - ${{ if eq(parameters.innerLoop, 'false') }}: - ${{ if and(eq(parameters.runSpecific, 'false'), eq(parameters.useVSTestTask, 'false')) }}: - - script: set PATH=%PATH%;%USERPROFILE%\.nuget\packages\libtorch-cpu-win-x64\1.13.0.1\runtimes\win-x64\native;%USERPROFILE%\.nuget\packages\torchsharp\0.99.5\runtimes\win-x64\native & ${{ parameters.buildScript }} /p:Build=false -configuration $(_configuration) /p:TargetArchitecture=${{ parameters.architecture }} /p:TestArchitectures=${{ parameters.architecture }} -test -integrationTest /p:Coverage=${{ parameters.codeCoverage }} $(testTargetFramework) + - script: set PATH=%PATH%;%USERPROFILE%\.nuget\packages\libtorch-cpu-win-x64\2.1.0.1\runtimes\win-x64\native;%USERPROFILE%\.nuget\packages\torchsharp\0.101.5\runtimes\win-x64\native & ${{ parameters.buildScript }} /p:Build=false -configuration $(_configuration) /p:TargetArchitecture=${{ parameters.architecture }} /p:TestArchitectures=${{ parameters.architecture }} -test -integrationTest /p:Coverage=${{ parameters.codeCoverage }} $(testTargetFramework) displayName: Run All Tests. - ${{ if and(eq(parameters.runSpecific, 'true'), eq(parameters.useVSTestTask, 'false')) }}: - script: ${{ parameters.buildScript }} /p:Build=false -configuration $(_configuration) /p:TargetArchitecture=${{ parameters.architecture }} /p:TestArchitectures=${{ parameters.architecture }} -test -integrationTest /p:TestRunnerAdditionalArguments='-trait$(spaceValue)Category=RunSpecificTest' /p:Coverage=${{ parameters.codeCoverage }} $(testTargetFramework) diff --git a/eng/Versions.props b/eng/Versions.props index 664669e5b8..059855234d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -62,8 +62,8 @@ 0.20.1 2 2.3.1 - 0.99.5 - 1.13.0.1 + 0.101.5 + 2.1.0.1 1.12.4 3.1.2 diff --git a/src/Microsoft.ML.TorchSharp/AutoFormerV2/ObjectDetectionTrainer.cs b/src/Microsoft.ML.TorchSharp/AutoFormerV2/ObjectDetectionTrainer.cs index a2a900f837..f999c49cd3 100644 --- a/src/Microsoft.ML.TorchSharp/AutoFormerV2/ObjectDetectionTrainer.cs +++ b/src/Microsoft.ML.TorchSharp/AutoFormerV2/ObjectDetectionTrainer.cs @@ -225,7 +225,7 @@ public Trainer(ObjectDetectionTrainer parent, IChannel ch, IDataView input) Device = TorchUtils.InitializeDevice(Parent.Host); // Move to GPU if we are running there - if (Device == CUDA) + if (Device.type == DeviceType.CUDA) Model.cuda(); // Get the parameters that need optimization and set up the optimizer @@ -531,7 +531,7 @@ internal ObjectDetectionTransformer(IHostEnvironment env, ObjectDetectionTrainer Model = model; Model.eval(); - if (Device == CUDA) + if (Device.type == DeviceType.CUDA) Model.cuda(); } diff --git a/src/Microsoft.ML.TorchSharp/Roberta/QATrainer.cs b/src/Microsoft.ML.TorchSharp/Roberta/QATrainer.cs index 4fdccbd01e..6e69c56e32 100644 --- a/src/Microsoft.ML.TorchSharp/Roberta/QATrainer.cs +++ b/src/Microsoft.ML.TorchSharp/Roberta/QATrainer.cs @@ -207,7 +207,7 @@ public Trainer(QATrainer parent, IChannel ch, IDataView input) Device = TorchUtils.InitializeDevice(Parent.Host); // Move to GPU if we are running there - if (Device == CUDA) + if (Device.type == DeviceType.CUDA) Model.cuda(); Tokenizer = TokenizerExtensions.GetInstance(ch); @@ -574,7 +574,7 @@ internal QATransformer(IHostEnvironment env, QATrainer.Options options, RobertaM Model = model; Model.eval(); - if (Device == CUDA) + if (Device.type == DeviceType.CUDA) Model.cuda(); using (var ch = Host.Start("Initialize Tokenizer")) Tokenizer = TokenizerExtensions.GetInstance(ch); diff --git a/src/Microsoft.ML.TorchSharp/TorchSharpBaseTrainer.cs b/src/Microsoft.ML.TorchSharp/TorchSharpBaseTrainer.cs index 8f117a6b67..07e7abc758 100644 --- a/src/Microsoft.ML.TorchSharp/TorchSharpBaseTrainer.cs +++ b/src/Microsoft.ML.TorchSharp/TorchSharpBaseTrainer.cs @@ -158,7 +158,7 @@ public TrainerBase(TorchSharpBaseTrainer parent, IChanne Device = TorchUtils.InitializeDevice(Parent.Host); // Move to GPU if we are running there - if (Device == CUDA) + if (Device.type == DeviceType.CUDA) Model.cuda(); } @@ -395,7 +395,7 @@ internal TorchSharpBaseTransformer(IHostEnvironment env, TorchSharpBaseTrainer.O Model = model; - if (Device == CUDA) + if (Device.type == DeviceType.CUDA) Model.cuda(); } diff --git a/test/Microsoft.ML.TensorFlow.Tests/Properties/AssemblyInfo.cs b/test/Microsoft.ML.TensorFlow.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..70da298f72 --- /dev/null +++ b/test/Microsoft.ML.TensorFlow.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,7 @@ +// 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 Xunit; + +[assembly: CollectionBehavior(DisableTestParallelization = true)] diff --git a/test/Microsoft.ML.TensorFlow.Tests/TensorflowTests.cs b/test/Microsoft.ML.TensorFlow.Tests/TensorflowTests.cs index 38b3ab97ec..665be60361 100644 --- a/test/Microsoft.ML.TensorFlow.Tests/TensorflowTests.cs +++ b/test/Microsoft.ML.TensorFlow.Tests/TensorflowTests.cs @@ -23,9 +23,8 @@ using static Microsoft.ML.DataOperationsCatalog; using InMemoryImage = Microsoft.ML.Tests.ImageTests.InMemoryImage; -namespace Microsoft.ML.Scenarios +namespace Microsoft.ML.TensorFlow.Scenarios { - internal sealed class TensorFlowScenariosTestsFixture : IDisposable { public static string tempFolder; @@ -57,7 +56,6 @@ public void Dispose() } } - [Collection("NoParallelization")] public sealed class TensorFlowScenariosTests : BaseTestClass, IClassFixture { private readonly string _fullImagesetFolderPath; diff --git a/test/Microsoft.ML.Tests/Microsoft.ML.Tests.csproj b/test/Microsoft.ML.Tests/Microsoft.ML.Tests.csproj index 57b7dd3331..dc43089688 100644 --- a/test/Microsoft.ML.Tests/Microsoft.ML.Tests.csproj +++ b/test/Microsoft.ML.Tests/Microsoft.ML.Tests.csproj @@ -56,12 +56,6 @@ - - - PreserveNewest - - - @@ -69,8 +63,4 @@ - - - - diff --git a/test/Microsoft.ML.Tests/Properties/AssemblyInfo.cs b/test/Microsoft.ML.Tests/Properties/AssemblyInfo.cs index 763d3090ae..0f7ea11eff 100644 --- a/test/Microsoft.ML.Tests/Properties/AssemblyInfo.cs +++ b/test/Microsoft.ML.Tests/Properties/AssemblyInfo.cs @@ -3,6 +3,3 @@ // See the LICENSE file in the project root for more information. using Xunit; - -// TODO: [TEST_STABILITY] disable test parallelization for this assembly as running test in parallel sometimes cause test host process to crash -[assembly: CollectionBehavior(DisableTestParallelization = true)] diff --git a/test/Microsoft.ML.TorchSharp.Tests/Microsoft.ML.TorchSharp.Tests.csproj b/test/Microsoft.ML.TorchSharp.Tests/Microsoft.ML.TorchSharp.Tests.csproj index 32d6552e6d..4d7de3e37e 100644 --- a/test/Microsoft.ML.TorchSharp.Tests/Microsoft.ML.TorchSharp.Tests.csproj +++ b/test/Microsoft.ML.TorchSharp.Tests/Microsoft.ML.TorchSharp.Tests.csproj @@ -3,6 +3,9 @@ Microsoft.ML.TorchSharp.Tests Test + + None + @@ -23,7 +26,7 @@ - + diff --git a/test/Microsoft.ML.TorchSharp.Tests/NerTests.cs b/test/Microsoft.ML.TorchSharp.Tests/NerTests.cs index 3746cc87d8..1b952b8e29 100644 --- a/test/Microsoft.ML.TorchSharp.Tests/NerTests.cs +++ b/test/Microsoft.ML.TorchSharp.Tests/NerTests.cs @@ -11,9 +11,8 @@ using Xunit; using Xunit.Abstractions; -namespace Microsoft.ML.Tests +namespace Microsoft.ML.TorchSharp.Tests { - [Collection("NoParallelization")] public class NerTests : TestDataPipeBase { public NerTests(ITestOutputHelper output) : base(output) diff --git a/test/Microsoft.ML.TorchSharp.Tests/ObjectDetectionTests.cs b/test/Microsoft.ML.TorchSharp.Tests/ObjectDetectionTests.cs index c36156d196..072768f71f 100644 --- a/test/Microsoft.ML.TorchSharp.Tests/ObjectDetectionTests.cs +++ b/test/Microsoft.ML.TorchSharp.Tests/ObjectDetectionTests.cs @@ -14,7 +14,7 @@ using Microsoft.ML.Runtime; using System.Collections.Generic; -namespace Microsoft.ML.Tests +namespace Microsoft.ML.TorchSharp.Tests { [Collection("NoParallelization")] diff --git a/test/Microsoft.ML.TorchSharp.Tests/Properties/AssemblyInfo.cs b/test/Microsoft.ML.TorchSharp.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..70da298f72 --- /dev/null +++ b/test/Microsoft.ML.TorchSharp.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,7 @@ +// 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 Xunit; + +[assembly: CollectionBehavior(DisableTestParallelization = true)] diff --git a/test/Microsoft.ML.TorchSharp.Tests/QATests.cs b/test/Microsoft.ML.TorchSharp.Tests/QATests.cs index 8684ce0a9d..f1b8d9d772 100644 --- a/test/Microsoft.ML.TorchSharp.Tests/QATests.cs +++ b/test/Microsoft.ML.TorchSharp.Tests/QATests.cs @@ -10,9 +10,8 @@ using Xunit; using Xunit.Abstractions; -namespace Microsoft.ML.Tests +namespace Microsoft.ML.TorchSharp.Tests { - [Collection("NoParallelization")] public class QATests : TestDataPipeBase { public QATests(ITestOutputHelper output) : base(output) diff --git a/test/Microsoft.ML.TorchSharp.Tests/TextClassificationTests.cs b/test/Microsoft.ML.TorchSharp.Tests/TextClassificationTests.cs index 0a00cb1047..1493c4d703 100644 --- a/test/Microsoft.ML.TorchSharp.Tests/TextClassificationTests.cs +++ b/test/Microsoft.ML.TorchSharp.Tests/TextClassificationTests.cs @@ -15,9 +15,8 @@ using Xunit; using Xunit.Abstractions; -namespace Microsoft.ML.Tests +namespace Microsoft.ML.TorchSharp.Tests { - [Collection("NoParallelization")] public class TextClassificationTests : TestDataPipeBase { public TextClassificationTests(ITestOutputHelper output) : base(output) @@ -172,7 +171,7 @@ public void TestTextClassificationWithBigDataOnGpu() var mlContext = new MLContext(); mlContext.GpuDeviceId = 0; mlContext.FallbackToCpu = false; - var df = DataFrame.LoadCsv(@"Data\github-issues-train.tsv", separator: '\t', header: true, columnNames: new[] { "ID", "Label", "Title", "Description" }); + var df = DataFrame.LoadCsv(GetDataPath("github-issues-train.tsv"), separator: '\t', header: true, columnNames: new[] { "ID", "Label", "Title", "Description" }); var trainTestSplit = mlContext.Data.TrainTestSplit(df, testFraction: 0.2); var pipeline = mlContext.Transforms.Conversion.MapValueToKey("Label") diff --git a/test/Microsoft.ML.Tests/Data/github-issues-train.tsv b/test/data/github-issues-train.tsv similarity index 100% rename from test/Microsoft.ML.Tests/Data/github-issues-train.tsv rename to test/data/github-issues-train.tsv