Repository navigation
Add netstandard2.0 target for .NET Framework - #66
Merged
Merged
Conversation
The downloader now refuses a directory whose metadata names another repository or an older commit, and asks the hub for the commit also when every file is there. EmbeddingGemma takes files from two repositories in one directory, and a cached model must also be completed after its repository has moved, so the model downloaders call it through DownloadMissingFilesAsync, which makes no request when every file is there and otherwise removes the metadata of the previous download.
ElBruno.LocalEmbeddings also builds for netstandard2.0, so .NET Framework 4.6.2+ apps can use it. The code paths that differ are under #if NETSTANDARD2_0 and the new settings and packages are in netstandard2.0-only sections of the project. A buildTransitive target copies the native libraries of ONNX Runtime next to .NET Framework applications, in the version NuGet resolved for the application, and stops the build of 32-bit ones. The tests also run on net48 on Windows, locally and in a new windows-latest job of the publish workflow. That job can stop a release, so three tests that were not stable on Windows change. BatchEmbeddingTests read the progress reports as they are made: with Progress<T> they arrived out of order on .NET Framework, and the tests failed in 4 of 15 runs. TestDataFixture has one directory for each instance, as an instance can fail while another deletes a shared one. The cancellation test of CustomEmbedderTests has a delay of 60 s instead of 5 s, as a busy machine can run both timers late and together.
The native files now come from the folder of Microsoft.ML.OnnxRuntime in the assets file, so a version raised on Microsoft.ML.OnnxRuntime.Managed alone or a fallback folder no longer give the wrong files or none. They are not copied when the application excludes the native assets of Microsoft.ML.OnnxRuntime, or already copies a file with the same name, as onnxruntime.dll of Microsoft.ML.OnnxRuntime.DirectML.
The native files are now the RuntimeTargetsCopyLocalItems of Microsoft.ML.OnnxRuntime for the target framework, instead of the task ResolvePackageDependencies of the SDK. They follow the version, the IncludeAssets and ExcludeAssets of each target framework of the application, and a file with the same name of a referenced project or of another package stops the copy. When NuGet resolved them for another runtime, as the win-x86 that the SDK gives to an application without PlatformTarget, the folder is the one of the version of the managed assembly.
…ep the packages on one version The target now runs before _CopyFilesMarkedCopyLocal, so GetCopyToOutputDirectoryItems also collects the items that targets add after the compilation. The README says to keep all the ElBruno.LocalEmbeddings packages on the same version, as they share ElBruno.HuggingFace.Downloader.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #65
Adds a
netstandard2.0target to the core package, so .NET Framework 4.6.2+ apps can install it, on x64 and ARM64. The other packages stay on net8.0 and net10.0.Summary
DownloadMissingFilesAsyncinsrc/Shared, which keeps the behavior of 0.6.0 in the five downloaders. With the bump alone, EmbeddingGemma can't start from an empty cache and 7 tests fail.Nullable=annotationson the new target only.onnxruntime.dllnext to .NET Framework apps, from the Microsoft.ML.OnnxRuntime package NuGet resolved. Otherwise Windows can load another one and crash. Not when the app excludes those native assets or already copies one, as with DirectML.test-netframeworkjob that runs the tests on net48 and thatpublishneeds.Validation
SharedModelTestsfailures on both).test-netframework370 passed, 42 skipped, 0 failed, also on Windows ARM64. The Linux steps ofpublish.ymlpass.On net8.0 and net10.0, a cancelled download now resumes and the model directory gets a
.hf.download.resolved.jsonfile.Limits: a 32-bit app fails at build with a message, because ONNX Runtime has no 32-bit library. The netstandard2.0 DLL is 440 KB, the others 91 KB.
Happy to split.