torch sharp version updates and test fixes
This commit is contained in:
Родитель
ec498d87a2
Коммит
e7b2a70262
|
@ -62,8 +62,8 @@
|
||||||
<TensorflowDotNETVersion>0.20.1</TensorflowDotNETVersion>
|
<TensorflowDotNETVersion>0.20.1</TensorflowDotNETVersion>
|
||||||
<TensorFlowMajorVersion>2</TensorFlowMajorVersion>
|
<TensorFlowMajorVersion>2</TensorFlowMajorVersion>
|
||||||
<TensorFlowVersion>2.3.1</TensorFlowVersion>
|
<TensorFlowVersion>2.3.1</TensorFlowVersion>
|
||||||
<TorchSharpVersion>0.99.5</TorchSharpVersion>
|
<TorchSharpVersion>0.101.5</TorchSharpVersion>
|
||||||
<LibTorchVersion>1.13.0.1</LibTorchVersion>
|
<LibTorchVersion>2.1.0.1</LibTorchVersion>
|
||||||
<!-- Build/infrastructure Dependencies -->
|
<!-- Build/infrastructure Dependencies -->
|
||||||
<CodecovVersion>1.12.4</CodecovVersion>
|
<CodecovVersion>1.12.4</CodecovVersion>
|
||||||
<CoverletCollectorVersion>3.1.2</CoverletCollectorVersion>
|
<CoverletCollectorVersion>3.1.2</CoverletCollectorVersion>
|
||||||
|
|
|
@ -225,7 +225,7 @@ namespace Microsoft.ML.TorchSharp.AutoFormerV2
|
||||||
Device = TorchUtils.InitializeDevice(Parent.Host);
|
Device = TorchUtils.InitializeDevice(Parent.Host);
|
||||||
|
|
||||||
// Move to GPU if we are running there
|
// Move to GPU if we are running there
|
||||||
if (Device == CUDA)
|
if (Device.type == DeviceType.CUDA)
|
||||||
Model.cuda();
|
Model.cuda();
|
||||||
|
|
||||||
// Get the parameters that need optimization and set up the optimizer
|
// Get the parameters that need optimization and set up the optimizer
|
||||||
|
@ -531,7 +531,7 @@ namespace Microsoft.ML.TorchSharp.AutoFormerV2
|
||||||
Model = model;
|
Model = model;
|
||||||
Model.eval();
|
Model.eval();
|
||||||
|
|
||||||
if (Device == CUDA)
|
if (Device.type == DeviceType.CUDA)
|
||||||
Model.cuda();
|
Model.cuda();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ namespace Microsoft.ML.TorchSharp.Roberta
|
||||||
Device = TorchUtils.InitializeDevice(Parent.Host);
|
Device = TorchUtils.InitializeDevice(Parent.Host);
|
||||||
|
|
||||||
// Move to GPU if we are running there
|
// Move to GPU if we are running there
|
||||||
if (Device == CUDA)
|
if (Device.type == DeviceType.CUDA)
|
||||||
Model.cuda();
|
Model.cuda();
|
||||||
|
|
||||||
Tokenizer = TokenizerExtensions.GetInstance(ch);
|
Tokenizer = TokenizerExtensions.GetInstance(ch);
|
||||||
|
@ -574,7 +574,7 @@ namespace Microsoft.ML.TorchSharp.Roberta
|
||||||
Model = model;
|
Model = model;
|
||||||
Model.eval();
|
Model.eval();
|
||||||
|
|
||||||
if (Device == CUDA)
|
if (Device.type == DeviceType.CUDA)
|
||||||
Model.cuda();
|
Model.cuda();
|
||||||
using (var ch = Host.Start("Initialize Tokenizer"))
|
using (var ch = Host.Start("Initialize Tokenizer"))
|
||||||
Tokenizer = TokenizerExtensions.GetInstance(ch);
|
Tokenizer = TokenizerExtensions.GetInstance(ch);
|
||||||
|
|
|
@ -158,7 +158,7 @@ namespace Microsoft.ML.TorchSharp
|
||||||
Device = TorchUtils.InitializeDevice(Parent.Host);
|
Device = TorchUtils.InitializeDevice(Parent.Host);
|
||||||
|
|
||||||
// Move to GPU if we are running there
|
// Move to GPU if we are running there
|
||||||
if (Device == CUDA)
|
if (Device.type == DeviceType.CUDA)
|
||||||
Model.cuda();
|
Model.cuda();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ namespace Microsoft.ML.TorchSharp
|
||||||
|
|
||||||
Model = model;
|
Model = model;
|
||||||
|
|
||||||
if (Device == CUDA)
|
if (Device.type == DeviceType.CUDA)
|
||||||
Model.cuda();
|
Model.cuda();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)]
|
|
@ -23,9 +23,8 @@ using Xunit.Abstractions;
|
||||||
using static Microsoft.ML.DataOperationsCatalog;
|
using static Microsoft.ML.DataOperationsCatalog;
|
||||||
using InMemoryImage = Microsoft.ML.Tests.ImageTests.InMemoryImage;
|
using InMemoryImage = Microsoft.ML.Tests.ImageTests.InMemoryImage;
|
||||||
|
|
||||||
namespace Microsoft.ML.Scenarios
|
namespace Microsoft.ML.TensorFlow.Scenarios
|
||||||
{
|
{
|
||||||
|
|
||||||
internal sealed class TensorFlowScenariosTestsFixture : IDisposable
|
internal sealed class TensorFlowScenariosTestsFixture : IDisposable
|
||||||
{
|
{
|
||||||
public static string tempFolder;
|
public static string tempFolder;
|
||||||
|
@ -57,7 +56,6 @@ namespace Microsoft.ML.Scenarios
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Collection("NoParallelization")]
|
|
||||||
public sealed class TensorFlowScenariosTests : BaseTestClass, IClassFixture<TensorFlowScenariosTestsFixture>
|
public sealed class TensorFlowScenariosTests : BaseTestClass, IClassFixture<TensorFlowScenariosTestsFixture>
|
||||||
{
|
{
|
||||||
private readonly string _fullImagesetFolderPath;
|
private readonly string _fullImagesetFolderPath;
|
||||||
|
|
|
@ -56,12 +56,6 @@
|
||||||
<PackageReference Include="System.Data.SQLite.Core" Version="$(SystemDataSQLiteCoreVersion)" />
|
<PackageReference Include="System.Data.SQLite.Core" Version="$(SystemDataSQLiteCoreVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="Data\**">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprBindExInput.txt" />
|
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprBindExInput.txt" />
|
||||||
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprBindInput.txt" />
|
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprBindInput.txt" />
|
||||||
|
@ -69,8 +63,4 @@
|
||||||
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprEvalInput.txt" />
|
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprEvalInput.txt" />
|
||||||
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprParseInput.txt" />
|
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprParseInput.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Properties\" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -3,6 +3,3 @@
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using Xunit;
|
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)]
|
|
||||||
|
|
Не удается отобразить этот файл, потому что он слишком большой.
|
|
@ -3,6 +3,9 @@
|
||||||
<AssemblyName>Microsoft.ML.TorchSharp.Tests</AssemblyName>
|
<AssemblyName>Microsoft.ML.TorchSharp.Tests</AssemblyName>
|
||||||
<StrongNameKeyId>Test</StrongNameKeyId>
|
<StrongNameKeyId>Test</StrongNameKeyId>
|
||||||
|
|
||||||
|
<!-- Remove once we have resolved the TorchSharp issue. -->
|
||||||
|
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
|
||||||
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<!-- Import the test signing certificate -->
|
<!-- Import the test signing certificate -->
|
||||||
|
@ -23,7 +26,7 @@
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetArchitecture)' == 'x64'">
|
<ItemGroup Condition="'$(TargetArchitecture)' == 'x64'">
|
||||||
<PackageReference Include="libtorch-cpu-win-x64" Version="$(LibTorchVersion)" Condition="$([MSBuild]::IsOSPlatform('Windows')) AND '$(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-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'" />
|
<PackageReference Include="libtorch-cpu-osx-x64" Version="$(LibTorchVersion)" Condition="$([MSBuild]::IsOSPlatform('OSX')) AND '$(TargetArchitecture)' == 'x64'" />
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,8 @@ using Microsoft.ML.TorchSharp.NasBert;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.ML.Tests
|
namespace Microsoft.ML.TorchSharp.Tests
|
||||||
{
|
{
|
||||||
[Collection("NoParallelization")]
|
|
||||||
public class NerTests : TestDataPipeBase
|
public class NerTests : TestDataPipeBase
|
||||||
{
|
{
|
||||||
public NerTests(ITestOutputHelper output) : base(output)
|
public NerTests(ITestOutputHelper output) : base(output)
|
||||||
|
|
|
@ -14,7 +14,7 @@ using Microsoft.ML.TorchSharp.AutoFormerV2;
|
||||||
using Microsoft.ML.Runtime;
|
using Microsoft.ML.Runtime;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.ML.Tests
|
namespace Microsoft.ML.TorchSharp.Tests
|
||||||
{
|
{
|
||||||
[Collection("NoParallelization")]
|
[Collection("NoParallelization")]
|
||||||
|
|
||||||
|
|
|
@ -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)]
|
|
@ -10,9 +10,8 @@ using Microsoft.ML.TorchSharp;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.ML.Tests
|
namespace Microsoft.ML.TorchSharp.Tests
|
||||||
{
|
{
|
||||||
[Collection("NoParallelization")]
|
|
||||||
public class QATests : TestDataPipeBase
|
public class QATests : TestDataPipeBase
|
||||||
{
|
{
|
||||||
public QATests(ITestOutputHelper output) : base(output)
|
public QATests(ITestOutputHelper output) : base(output)
|
||||||
|
|
|
@ -15,9 +15,8 @@ using Microsoft.ML.TorchSharp.NasBert;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.ML.Tests
|
namespace Microsoft.ML.TorchSharp.Tests
|
||||||
{
|
{
|
||||||
[Collection("NoParallelization")]
|
|
||||||
public class TextClassificationTests : TestDataPipeBase
|
public class TextClassificationTests : TestDataPipeBase
|
||||||
{
|
{
|
||||||
public TextClassificationTests(ITestOutputHelper output) : base(output)
|
public TextClassificationTests(ITestOutputHelper output) : base(output)
|
||||||
|
@ -172,7 +171,7 @@ namespace Microsoft.ML.Tests
|
||||||
var mlContext = new MLContext();
|
var mlContext = new MLContext();
|
||||||
mlContext.GpuDeviceId = 0;
|
mlContext.GpuDeviceId = 0;
|
||||||
mlContext.FallbackToCpu = false;
|
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 trainTestSplit = mlContext.Data.TrainTestSplit(df, testFraction: 0.2);
|
||||||
var pipeline =
|
var pipeline =
|
||||||
mlContext.Transforms.Conversion.MapValueToKey("Label")
|
mlContext.Transforms.Conversion.MapValueToKey("Label")
|
||||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Загрузка…
Ссылка в новой задаче