Update ML.NET to work with .NET8 (#6641)
* updates for .net8 * Updates for .net 8 * fixed net6 to net6.0 * fixed approval tests
This commit is contained in:
Родитель
33342a2f07
Коммит
7780efb474
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
|
||||
<NoWarn>$(NoWarn);MSB3270</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
<!--This ensures that we can never make the mistake of adding this as a friend assembly. Please don't remove.-->
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ICSharpCode.SharpZipLib.GZip;
|
||||
using ICSharpCode.SharpZipLib.Tar;
|
||||
using Microsoft.ML;
|
||||
|
@ -23,7 +25,9 @@ namespace Samples.Dynamic
|
|||
string modelLocation = "resnet_v2_101_299_frozen.pb";
|
||||
if (!File.Exists(modelLocation))
|
||||
{
|
||||
modelLocation = Download(@"https://storage.googleapis.com/download.tensorflow.org/models/tflite_11_05_08/resnet_v2_101.tgz", @"resnet_v2_101_299_frozen.tgz");
|
||||
var downloadTask = Download(@"https://storage.googleapis.com/download.tensorflow.org/models/tflite_11_05_08/resnet_v2_101.tgz", @"resnet_v2_101_299_frozen.tgz");
|
||||
downloadTask.Wait();
|
||||
modelLocation = downloadTask.Result;
|
||||
Unzip(Path.Join(Directory.GetCurrentDirectory(), modelLocation),
|
||||
Directory.GetCurrentDirectory());
|
||||
|
||||
|
@ -111,11 +115,18 @@ namespace Samples.Dynamic
|
|||
public float[] output { get; set; }
|
||||
}
|
||||
|
||||
private static string Download(string baseGitPath, string dataFile)
|
||||
private static async Task<string> Download(string baseGitPath, string dataFile)
|
||||
{
|
||||
using (WebClient client = new WebClient())
|
||||
if (File.Exists(dataFile))
|
||||
return dataFile;
|
||||
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
client.DownloadFile(new Uri($"{baseGitPath}"), dataFile);
|
||||
var response = await client.GetStreamAsync(new Uri($"{baseGitPath}")).ConfigureAwait(false);
|
||||
using (var fs = new FileStream(dataFile, FileMode.CreateNew))
|
||||
{
|
||||
await response.CopyToAsync(fs).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
return dataFile;
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.ML;
|
||||
|
@ -244,14 +245,14 @@ namespace Samples.Dynamic
|
|||
string fileName = "flower_photos_small_set.zip";
|
||||
string url = $"https://aka.ms/mlnet-resources/datasets/flower_photos_small_set.zip";
|
||||
|
||||
Download(url, imagesDownloadFolder, fileName);
|
||||
Download(url, imagesDownloadFolder, fileName).Wait();
|
||||
UnZip(Path.Combine(imagesDownloadFolder, fileName), imagesDownloadFolder);
|
||||
|
||||
return Path.GetFileNameWithoutExtension(fileName);
|
||||
}
|
||||
|
||||
// Download file to destination directory from input URL.
|
||||
public static bool Download(string url, string destDir, string destFileName)
|
||||
public static async Task<bool> Download(string url, string destDir, string destFileName)
|
||||
{
|
||||
if (destFileName == null)
|
||||
destFileName = url.Split(Path.DirectorySeparatorChar).Last();
|
||||
|
@ -266,14 +267,18 @@ namespace Samples.Dynamic
|
|||
return false;
|
||||
}
|
||||
|
||||
var wc = new WebClient();
|
||||
Console.WriteLine($"Downloading {relativeFilePath}");
|
||||
var download = Task.Run(() => wc.DownloadFile(url, relativeFilePath));
|
||||
while (!download.IsCompleted)
|
||||
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
Console.Write(".");
|
||||
var response = await client.GetStreamAsync(new Uri($"{url}")).ConfigureAwait(false);
|
||||
|
||||
using (var fs = new FileStream(relativeFilePath, FileMode.CreateNew))
|
||||
{
|
||||
await response.CopyToAsync(fs);
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine($"Downloaded {relativeFilePath}");
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.ML;
|
||||
|
@ -275,7 +276,7 @@ namespace Samples.Dynamic
|
|||
// https://github.com/YoongiKim/CIFAR-10-images
|
||||
string url = $"https://github.com/YoongiKim/CIFAR-10-images/archive/refs/heads/master.zip";
|
||||
|
||||
Download(url, imagesDownloadFolder, fileName);
|
||||
Download(url, imagesDownloadFolder, fileName).Wait();
|
||||
UnZip(Path.Combine(imagesDownloadFolder, fileName),
|
||||
imagesDownloadFolder);
|
||||
|
||||
|
@ -283,7 +284,7 @@ namespace Samples.Dynamic
|
|||
}
|
||||
|
||||
// Download file to destination directory from input URL.
|
||||
public static bool Download(string url, string destDir, string destFileName)
|
||||
public static async Task<bool> Download(string url, string destDir, string destFileName)
|
||||
{
|
||||
if (destFileName == null)
|
||||
destFileName = url.Split(Path.DirectorySeparatorChar).Last();
|
||||
|
@ -298,14 +299,18 @@ namespace Samples.Dynamic
|
|||
return false;
|
||||
}
|
||||
|
||||
var wc = new WebClient();
|
||||
Console.WriteLine($"Downloading {relativeFilePath}");
|
||||
var download = Task.Run(() => wc.DownloadFile(url, relativeFilePath));
|
||||
while (!download.IsCompleted)
|
||||
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
Console.Write(".");
|
||||
var response = await client.GetStreamAsync(new Uri($"{url}")).ConfigureAwait(false);
|
||||
|
||||
using (var fs = new FileStream(relativeFilePath, FileMode.CreateNew))
|
||||
{
|
||||
await response.CopyToAsync(fs);
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine($"Downloaded {relativeFilePath}");
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.ML;
|
||||
|
@ -232,14 +233,14 @@ namespace Samples.Dynamic
|
|||
string fileName = "flower_photos_small_set.zip";
|
||||
string url = $"https://aka.ms/mlnet-resources/datasets/flower_photos_small_set.zip";
|
||||
|
||||
Download(url, imagesDownloadFolder, fileName);
|
||||
Download(url, imagesDownloadFolder, fileName).Wait();
|
||||
UnZip(Path.Combine(imagesDownloadFolder, fileName), imagesDownloadFolder);
|
||||
|
||||
return Path.GetFileNameWithoutExtension(fileName);
|
||||
}
|
||||
|
||||
// Download file to destination directory from input URL.
|
||||
public static bool Download(string url, string destDir, string destFileName)
|
||||
public static async Task<bool> Download(string url, string destDir, string destFileName)
|
||||
{
|
||||
if (destFileName == null)
|
||||
destFileName = url.Split(Path.DirectorySeparatorChar).Last();
|
||||
|
@ -254,14 +255,18 @@ namespace Samples.Dynamic
|
|||
return false;
|
||||
}
|
||||
|
||||
var wc = new WebClient();
|
||||
Console.WriteLine($"Downloading {relativeFilePath}");
|
||||
var download = Task.Run(() => wc.DownloadFile(url, relativeFilePath));
|
||||
while (!download.IsCompleted)
|
||||
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
Console.Write(".");
|
||||
var response = await client.GetStreamAsync(new Uri($"{url}")).ConfigureAwait(false);
|
||||
|
||||
using (var fs = new FileStream(relativeFilePath, FileMode.CreateNew))
|
||||
{
|
||||
await response.CopyToAsync(fs);
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine($"Downloaded {relativeFilePath}");
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.ML;
|
||||
|
@ -253,14 +254,14 @@ namespace Samples.Dynamic
|
|||
string fileName = "flower_photos_small_set.zip";
|
||||
string url = $"https://aka.ms/mlnet-resources/datasets/flower_photos_small_set.zip";
|
||||
|
||||
Download(url, imagesDownloadFolder, fileName);
|
||||
Download(url, imagesDownloadFolder, fileName).Wait();
|
||||
UnZip(Path.Combine(imagesDownloadFolder, fileName), imagesDownloadFolder);
|
||||
|
||||
return Path.GetFileNameWithoutExtension(fileName);
|
||||
}
|
||||
|
||||
// Download file to destination directory from input URL.
|
||||
public static bool Download(string url, string destDir, string destFileName)
|
||||
public static async Task<bool> Download(string url, string destDir, string destFileName)
|
||||
{
|
||||
if (destFileName == null)
|
||||
destFileName = url.Split(Path.DirectorySeparatorChar).Last();
|
||||
|
@ -275,14 +276,18 @@ namespace Samples.Dynamic
|
|||
return false;
|
||||
}
|
||||
|
||||
var wc = new WebClient();
|
||||
Console.WriteLine($"Downloading {relativeFilePath}");
|
||||
var download = Task.Run(() => wc.DownloadFile(url, relativeFilePath));
|
||||
while (!download.IsCompleted)
|
||||
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
Console.Write(".");
|
||||
var response = await client.GetStreamAsync(new Uri($"{url}")).ConfigureAwait(false);
|
||||
|
||||
using (var fs = new FileStream(relativeFilePath, FileMode.CreateNew))
|
||||
{
|
||||
await response.CopyToAsync(fs);
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine($"Downloaded {relativeFilePath}");
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
<!--This ensures that we can never make the mistake of adding this as a friend assembly. Please don't remove.-->
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
<ApprovalTestsVersion>5.4.7</ApprovalTestsVersion>
|
||||
<BenchmarkDotNetVersion>0.12.0</BenchmarkDotNetVersion>
|
||||
<DotNetRuntime60Version>6.0.9</DotNetRuntime60Version>
|
||||
<DotNetRuntime80Version>8.0.0-preview.3.23174.8</DotNetRuntime80Version>
|
||||
<FluentAssertionVersion>5.10.2</FluentAssertionVersion>
|
||||
<MicrosoftCodeAnalysisTestingVersion>1.1.2-beta1.22512.1</MicrosoftCodeAnalysisTestingVersion>
|
||||
<MicrosoftDotNetXUnitExtensionsVersion>7.0.0-beta.23073.6</MicrosoftDotNetXUnitExtensionsVersion>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<!-- The following properties are set to package M.D.A.Interactive with the M.D.A nuget package. If M.D.A.I undergoes TFM or dependency changes, we need to update the TargetFramework passed in below-->
|
||||
<Target Name="AddMDAIToInteractiveExtensionsFolder">
|
||||
<MSBuild Projects="./../Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj" Targets="_GetBuildOutputFilesWithTfm" Properties="TargetFramework=netcoreapp3.1">
|
||||
<MSBuild Projects="./../Microsoft.Data.Analysis.Interactive/Microsoft.Data.Analysis.Interactive.csproj" Targets="_GetBuildOutputFilesWithTfm" Properties="TargetFramework=net6.0">
|
||||
<!-- Manually hardcoding the TargetFramework to netcoreapp3.1 as that is the one that MDAI targets -->
|
||||
<Output TaskParameter="TargetOutputs" ItemName="_ItemsToIncludeForInteractive" />
|
||||
</MSBuild>
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Microsoft.ML.CodeGenerator.Templates.Console
|
|||
public virtual string TransformText()
|
||||
{
|
||||
this.Write("<Project Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n <PropertyGroup>\r\n <OutputType>Exe</Outp" +
|
||||
"utType>\r\n <TargetFramework>netcoreapp3.1</TargetFramework>\r\n </PropertyGroup" +
|
||||
"utType>\r\n <TargetFramework>net6.0</TargetFramework>\r\n </PropertyGroup" +
|
||||
">\r\n <ItemGroup>\r\n <PackageReference Include=\"Microsoft.ML\" Version=\"");
|
||||
this.Write(this.ToStringHelper.ToStringWithCulture(StablePackageVersion));
|
||||
this.Write("\" />\r\n");
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ML" Version="<#= StablePackageVersion #>" />
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -152,19 +154,10 @@ namespace Microsoft.ML.Internal.Utilities
|
|||
/// <returns>Returns the error message if an error occurred, null if download was successful.</returns>
|
||||
private async Task<string> DownloadFromUrlAsync(IHostEnvironment env, IChannel ch, string url, string fileName, int timeout, string filePath)
|
||||
{
|
||||
using (var webClient = new WebClient())
|
||||
using (var client = new HttpClient())
|
||||
using (var downloadCancel = new CancellationTokenSource())
|
||||
{
|
||||
bool deleteNeeded = false;
|
||||
EventHandler disposed =
|
||||
(object sender, EventArgs e) =>
|
||||
{
|
||||
if (File.Exists(filePath) && deleteNeeded)
|
||||
TryDelete(ch, filePath);
|
||||
};
|
||||
|
||||
webClient.Disposed += disposed;
|
||||
var t = Task.Run(() => DownloadResource(env, ch, webClient, new Uri(url), filePath, fileName, downloadCancel.Token));
|
||||
var t = Task.Run(() => DownloadResource(env, ch, client, new Uri(url), filePath, fileName, downloadCancel.Token));
|
||||
|
||||
UpdateTimeout(ref timeout);
|
||||
var timeoutTask = Task.Delay(timeout).ContinueWith(task => default(Exception), TaskScheduler.Default);
|
||||
|
@ -173,7 +166,8 @@ namespace Microsoft.ML.Internal.Utilities
|
|||
if (completedTask != t || completedTask.CompletedResult() != null)
|
||||
{
|
||||
downloadCancel.Cancel();
|
||||
deleteNeeded = true;
|
||||
if (File.Exists(filePath))
|
||||
TryDelete(ch, filePath);
|
||||
return (await t).Message;
|
||||
}
|
||||
return null;
|
||||
|
@ -252,7 +246,7 @@ namespace Microsoft.ML.Internal.Utilities
|
|||
return filePath;
|
||||
}
|
||||
|
||||
private Exception DownloadResource(IHostEnvironment env, IChannel ch, WebClient webClient, Uri uri, string path, string fileName, CancellationToken ct)
|
||||
private async Task<Exception> DownloadResource(IHostEnvironment env, IChannel ch, HttpClient httpClient, Uri uri, string path, string fileName, CancellationToken ct)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
return null;
|
||||
|
@ -271,41 +265,26 @@ namespace Microsoft.ML.Internal.Utilities
|
|||
{
|
||||
int blockSize = 4096;
|
||||
|
||||
using (var s = webClient.OpenRead(uri))
|
||||
var response = await httpClient.GetAsync(uri, ct).ConfigureAwait(false);
|
||||
using (var fh = env.CreateOutputFile(tempPath))
|
||||
using (var ws = fh.CreateWriteStream())
|
||||
{
|
||||
var headers = webClient.ResponseHeaders.GetValues("Content-Length");
|
||||
response.EnsureSuccessStatusCode();
|
||||
IEnumerable<string> headers;
|
||||
var hasHeader = response.Headers.TryGetValues("content-length", out headers);
|
||||
if (uri.Host == "aka.ms" && IsRedirectToDefaultPage(uri.AbsoluteUri))
|
||||
throw new NotSupportedException($"The provided url ({uri}) redirects to the default url ({DefaultUrl})");
|
||||
if (Utils.Size(headers) == 0 || !long.TryParse(headers[0], out var size))
|
||||
if (!hasHeader || !long.TryParse(headers.First(), out var size))
|
||||
size = 10000000;
|
||||
|
||||
long printFreq = (long)(size / 10.0);
|
||||
var buffer = new byte[blockSize];
|
||||
long total = 0;
|
||||
var stream = await response.EnsureSuccessStatusCode().Content.ReadAsStreamAsync().ConfigureAwait(false);
|
||||
|
||||
// REVIEW: use a progress channel instead.
|
||||
while (true)
|
||||
await stream.CopyToAsync(ws, blockSize, ct);
|
||||
|
||||
if (ct.IsCancellationRequested)
|
||||
{
|
||||
var task = s.ReadAsync(buffer, 0, blockSize, ct);
|
||||
task.Wait();
|
||||
int count = task.Result;
|
||||
|
||||
if (count <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ws.Write(buffer, 0, count);
|
||||
total += count;
|
||||
if ((total - (total / printFreq) * printFreq) <= blockSize)
|
||||
ch.Info($"{fileName}: Downloaded {total} bytes out of {size}");
|
||||
if (ct.IsCancellationRequested)
|
||||
{
|
||||
ch.Error($"{fileName}: Download timed out");
|
||||
return ch.Except("Download timed out");
|
||||
}
|
||||
ch.Error($"{fileName}: Download timed out");
|
||||
return ch.Except("Download timed out");
|
||||
}
|
||||
}
|
||||
File.Move(tempPath, path);
|
||||
|
@ -314,7 +293,7 @@ namespace Microsoft.ML.Internal.Utilities
|
|||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
ch.Error($"{fileName}: Could not download. WebClient returned the following error: {e.Message}");
|
||||
ch.Error($"{fileName}: Could not download. HttpClient returned the following error: {e.Message}");
|
||||
return e;
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(RepoRoot)eng/pkg/Pack.props"/>
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
|
||||
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
|
||||
<IncludeInPackage>Microsoft.ML.CpuMath</IncludeInPackage>
|
||||
<PackageDescription>Microsoft.ML.CpuMath contains optimized math routines for ML.NET.</PackageDescription>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
@ -15,7 +15,7 @@
|
|||
<!-- Workaround https://github.com/dotnet/project-system/issues/935 -->
|
||||
<None Include="**/*.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
|
||||
<Compile Remove="CpuMathUtils.netstandard.cs" />
|
||||
<Compile Remove="FactorizationMachine/FactorizationMachineInterface.netstandard.cs" />
|
||||
</ItemGroup>
|
||||
|
@ -31,7 +31,7 @@
|
|||
<Content Include="build\**\*" Pack="true" PackagePath="build" />
|
||||
</ItemGroup>
|
||||
<Target DependsOnTargets="ResolveReferences" Name="CopyProjectReferencesToPackage">
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'net6.0'">
|
||||
<!--Include native PDBs-->
|
||||
<!--The path needed to be hardcoded for this to work on our publishing CI-->
|
||||
<BuildOutputInPackage Condition="Exists('$(PackageAssetsPath)$(PackageIdFolderName)\runtimes\win-x86\nativeassets\netstandard2.0\CpuMathNative.pdb')" Include="$(PackageAssetsPath)$(PackageIdFolderName)\runtimes\win-x86\nativeassets\netstandard2.0\CpuMathNative.pdb" TargetPath="..\..\runtimes\win-x86\nativeassets\netstandard2.0" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<AssemblyName>DnnAnalyzer</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.ML.Data;
|
||||
|
||||
namespace Microsoft.ML.SamplesUtils
|
||||
|
@ -177,22 +180,26 @@ namespace Microsoft.ML.SamplesUtils
|
|||
if (!Directory.Exists(varPath))
|
||||
Directory.CreateDirectory(varPath);
|
||||
|
||||
Download(Path.Combine(remotePath, "saved_model.pb"), Path.Combine(path, "saved_model.pb"));
|
||||
Download(Path.Combine(remotePath, "imdb_word_index.csv"), Path.Combine(path, "imdb_word_index.csv"));
|
||||
Download(Path.Combine(remotePath, "variables", "variables.data-00000-of-00001"), Path.Combine(varPath, "variables.data-00000-of-00001"));
|
||||
Download(Path.Combine(remotePath, "variables", "variables.index"), Path.Combine(varPath, "variables.index"));
|
||||
Download(Path.Combine(remotePath, "saved_model.pb"), Path.Combine(path, "saved_model.pb")).Wait();
|
||||
Download(Path.Combine(remotePath, "imdb_word_index.csv"), Path.Combine(path, "imdb_word_index.csv")).Wait();
|
||||
Download(Path.Combine(remotePath, "variables", "variables.data-00000-of-00001"), Path.Combine(varPath, "variables.data-00000-of-00001")).Wait();
|
||||
Download(Path.Combine(remotePath, "variables", "variables.index"), Path.Combine(varPath, "variables.index")).Wait();
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
private static string Download(string baseGitPath, string dataFile)
|
||||
private static async Task<string> Download(string baseGitPath, string dataFile)
|
||||
{
|
||||
if (File.Exists(dataFile))
|
||||
return dataFile;
|
||||
|
||||
using (WebClient client = new WebClient())
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
client.DownloadFile(new Uri($"{baseGitPath}"), dataFile);
|
||||
var response = await client.GetStreamAsync(new Uri($"{baseGitPath}")).ConfigureAwait(false);
|
||||
using (var fs = new FileStream(dataFile, FileMode.CreateNew))
|
||||
{
|
||||
await response.CopyToAsync(fs).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
return dataFile;
|
||||
|
|
|
@ -185,7 +185,7 @@
|
|||
Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)CpuMathNative$(NativeLibExtension)"
|
||||
RelativePath="Microsoft.ML.CpuMath\runtimes\$(PackageRid)\nativeassets\netstandard2.0" />
|
||||
<NativePackageAsset Include="$(PlaceholderFile)"
|
||||
RelativePath="Microsoft.ML.CpuMath\runtimes\$(PackageRid)\nativeassets\netcoreapp3.1" />
|
||||
RelativePath="Microsoft.ML.CpuMath\runtimes\$(PackageRid)\nativeassets\net6.0" />
|
||||
<NativePackageAsset Include="$(NativeAssetsBuiltPath)\$(NativeLibPrefix)LdaNative$(NativeLibExtension)"
|
||||
RelativePath="Microsoft.ML\runtimes\$(PackageRid)\native" />
|
||||
<!-- TODO: once we fix the 4 intel MKL methods, SymSgdNative will need to go back in. -->
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ML" Version="stableversion" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ML" Version="StablePackageVersion" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ML" Version="stableversion" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ML" Version="1.3.1" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ML" Version="stableversion" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ML" Version="1.4.0-preview3-28229-2" />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ML" Version="1.4.0-preview3-28229-2" />
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<ProjectReference Include="..\Microsoft.ML.TestFramework\Microsoft.ML.TestFramework.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp3.1'))">
|
||||
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">
|
||||
<NativeAssemblyReference Include="CpuMathNative" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace Microsoft.ML.RunTests
|
|||
// on x64 vs x86 and dotnet core 3.1 vs others, so we have 4 combination:
|
||||
// x64-netcore3.1, x86-netcore3.1, x64-rest, x86-rest. In some cases x64 vs x86
|
||||
// have different results, in some cases netcore 3.1 vs rest have different results,
|
||||
// the most complicate situation is 12 combinations (x64 vs x86, netcoreapp3.1 vs rest,
|
||||
// the most complicate situation is 12 combinations (x64 vs x86, net6.0 vs rest,
|
||||
// win vs linux vs osx) have different results.
|
||||
// So use list of string to return different configurations and test will try to search
|
||||
// through this list and use the one file first found, make sure we don't have baseline file
|
||||
|
|
Загрузка…
Ссылка в новой задаче