Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion build/ci/job-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
<TensorflowDotNETVersion>0.20.1</TensorflowDotNETVersion>
<TensorFlowMajorVersion>2</TensorFlowMajorVersion>
<TensorFlowVersion>2.3.1</TensorFlowVersion>
<TorchSharpVersion>0.99.5</TorchSharpVersion>
<LibTorchVersion>1.13.0.1</LibTorchVersion>
<TorchSharpVersion>0.101.5</TorchSharpVersion>
<LibTorchVersion>2.1.0.1</LibTorchVersion>
<!-- Build/infrastructure Dependencies -->
<CodecovVersion>1.12.4</CodecovVersion>
<CoverletCollectorVersion>3.1.2</CoverletCollectorVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -531,7 +531,7 @@ internal ObjectDetectionTransformer(IHostEnvironment env, ObjectDetectionTrainer
Model = model;
Model.eval();

if (Device == CUDA)
if (Device.type == DeviceType.CUDA)
Model.cuda();
}

Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.ML.TorchSharp/Roberta/QATrainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.ML.TorchSharp/TorchSharpBaseTrainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public TrainerBase(TorchSharpBaseTrainer<TLabelCol, TTargetsCol> 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();
}

Expand Down Expand Up @@ -395,7 +395,7 @@ internal TorchSharpBaseTransformer(IHostEnvironment env, TorchSharpBaseTrainer.O

Model = model;

if (Device == CUDA)
if (Device.type == DeviceType.CUDA)
Model.cuda();
}

Expand Down
7 changes: 7 additions & 0 deletions test/Microsoft.ML.TensorFlow.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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)]
4 changes: 1 addition & 3 deletions test/Microsoft.ML.TensorFlow.Tests/TensorflowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -57,7 +56,6 @@ public void Dispose()
}
}

[Collection("NoParallelization")]
public sealed class TensorFlowScenariosTests : BaseTestClass, IClassFixture<TensorFlowScenariosTestsFixture>
{
private readonly string _fullImagesetFolderPath;
Expand Down
10 changes: 0 additions & 10 deletions test/Microsoft.ML.Tests/Microsoft.ML.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,11 @@
<PackageReference Include="System.Data.SQLite.Core" Version="$(SystemDataSQLiteCoreVersion)" />
</ItemGroup>

<ItemGroup>
<Content Include="Data\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprBindExInput.txt" />
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprBindInput.txt" />
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprCodeGenInput.txt" />
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprEvalInput.txt" />
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprParseInput.txt" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
3 changes: 0 additions & 3 deletions test/Microsoft.ML.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<AssemblyName>Microsoft.ML.TorchSharp.Tests</AssemblyName>
<StrongNameKeyId>Test</StrongNameKeyId>

<!-- Remove once we have resolved the TorchSharp issue. -->
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch

What this exactly does?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's required to avoid MSB3270, but I thought this wasn't needed on the 8.0 SDK - I thought that warning was completely removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. Its still required unless I am doing something wrong. Throws an error without that.


</PropertyGroup>

<!-- Import the test signing certificate -->
Expand All @@ -23,7 +26,7 @@

<ItemGroup Condition="'$(TargetArchitecture)' == 'x64'">
<PackageReference Include="libtorch-cpu-win-x64" Version="$(LibTorchVersion)" Condition="$([MSBuild]::IsOSPlatform('Windows')) AND '$(TargetArchitecture)' == 'x64'" />
<!-- <PackageReference Include="TorchSharp-cuda-windows" Version="0.99.5" Condition="$([MSBuild]::IsOSPlatform('Windows'))" /> -->
<!-- <PackageReference Include="TorchSharp-cuda-windows" Version="$(TorchSharpVersion)" Condition="$([MSBuild]::IsOSPlatform('Windows'))" /> -->
<PackageReference Include="libtorch-cpu-linux-x64" Version="$(LibTorchVersion)" Condition="$([MSBuild]::IsOSPlatform('Linux')) AND '$(TargetArchitecture)' == 'x64'" />
<PackageReference Include="libtorch-cpu-osx-x64" Version="$(LibTorchVersion)" Condition="$([MSBuild]::IsOSPlatform('OSX')) AND '$(TargetArchitecture)' == 'x64'" />

Expand Down
3 changes: 1 addition & 2 deletions test/Microsoft.ML.TorchSharp.Tests/NerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/Microsoft.ML.TorchSharp.Tests/ObjectDetectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using Microsoft.ML.Runtime;
using System.Collections.Generic;

namespace Microsoft.ML.Tests
namespace Microsoft.ML.TorchSharp.Tests
{
[Collection("NoParallelization")]

Expand Down
7 changes: 7 additions & 0 deletions test/Microsoft.ML.TorchSharp.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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)]
3 changes: 1 addition & 2 deletions test/Microsoft.ML.TorchSharp.Tests/QATests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions test/Microsoft.ML.TorchSharp.Tests/TextClassificationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down