torch sharp version updates and test fixes

This commit is contained in:
Michael Sharp 2024-01-11 15:51:19 -07:00 коммит произвёл github-actions
Родитель ec498d87a2
Коммит e7b2a70262
16 изменённых файлов: 13062 добавлений и 33 удалений

Просмотреть файл

@ -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>

Просмотреть файл

@ -225,7 +225,7 @@ namespace Microsoft.ML.TorchSharp.AutoFormerV2
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 @@ namespace Microsoft.ML.TorchSharp.AutoFormerV2
Model = model;
Model.eval();
if (Device == CUDA)
if (Device.type == DeviceType.CUDA)
Model.cuda();
}

Просмотреть файл

@ -207,7 +207,7 @@ namespace Microsoft.ML.TorchSharp.Roberta
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 @@ namespace Microsoft.ML.TorchSharp.Roberta
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);

Просмотреть файл

@ -158,7 +158,7 @@ namespace Microsoft.ML.TorchSharp
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 @@ namespace Microsoft.ML.TorchSharp
Model = model;
if (Device == CUDA)
if (Device.type == DeviceType.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 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 @@ namespace Microsoft.ML.Scenarios
}
}
[Collection("NoParallelization")]
public sealed class TensorFlowScenariosTests : BaseTestClass, IClassFixture<TensorFlowScenariosTestsFixture>
{
private readonly string _fullImagesetFolderPath;

Просмотреть файл

@ -56,12 +56,6 @@
<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" />
@ -69,8 +63,4 @@
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprEvalInput.txt" />
<EmbeddedResource Include="ExpressionLanguageTests\TestData\ExprParseInput.txt" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>

Просмотреть файл

@ -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)]

Просмотреть файл

Не удается отобразить этот файл, потому что он слишком большой.

Просмотреть файл

@ -3,6 +3,9 @@
<AssemblyName>Microsoft.ML.TorchSharp.Tests</AssemblyName>
<StrongNameKeyId>Test</StrongNameKeyId>
<!-- Remove once we have resolved the TorchSharp issue. -->
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
<!-- Import the test signing certificate -->
@ -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'" />

Просмотреть файл

@ -11,9 +11,8 @@ using Microsoft.ML.TorchSharp.NasBert;
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)

Просмотреть файл

@ -14,7 +14,7 @@ using Microsoft.ML.TorchSharp.AutoFormerV2;
using Microsoft.ML.Runtime;
using System.Collections.Generic;
namespace Microsoft.ML.Tests
namespace Microsoft.ML.TorchSharp.Tests
{
[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.Abstractions;
namespace Microsoft.ML.Tests
namespace Microsoft.ML.TorchSharp.Tests
{
[Collection("NoParallelization")]
public class QATests : TestDataPipeBase
{
public QATests(ITestOutputHelper output) : base(output)

Просмотреть файл

@ -15,9 +15,8 @@ using Microsoft.ML.TorchSharp.NasBert;
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 @@ namespace Microsoft.ML.Tests
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")

Различия файлов скрыты, потому что одна или несколько строк слишком длинны