WACS.WASI.NN.MLNet 0.2.4

dotnet add package WACS.WASI.NN.MLNet --version 0.2.4
                    
NuGet\Install-Package WACS.WASI.NN.MLNet -Version 0.2.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WACS.WASI.NN.MLNet" Version="0.2.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WACS.WASI.NN.MLNet" Version="0.2.4" />
                    
Directory.Packages.props
<PackageReference Include="WACS.WASI.NN.MLNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WACS.WASI.NN.MLNet --version 0.2.4
                    
#r "nuget: WACS.WASI.NN.MLNet, 0.2.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WACS.WASI.NN.MLNet@0.2.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WACS.WASI.NN.MLNet&version=0.2.4
                    
Install as a Cake Addin
#tool nuget:?package=WACS.WASI.NN.MLNet&version=0.2.4
                    
Install as a Cake Tool

WACS.WASI.NN.MLNet

ML.NET-flavored ONNX backend for WACS.WASI.NN. Implements IBackend for graph-encoding.onnx against Microsoft.ML.OnnxTransformer under an MLContext lifecycle — for embedders composing wasi-nn inference with the rest of an ML.NET pipeline (preprocessing transformers, custom predictors, IDataView / PredictionEngine).

For raw tensor inference with no pipeline integration, prefer WACS.WASI.NN.OnnxRuntime — it avoids the Microsoft.ML transitive surface (~70 MB lighter).

Install

dotnet add package WACS.WASI.NN.MLNet

The package's bin ships its NuGet transitives + RID-specific native libs (via <EnableDynamicLoading>true</EnableDynamicLoading>), so Assembly.LoadFrom resolves everything from the LoadFromContext probe.

CLI

# After dotnet build of this project's repo:
MLNET=$(realpath Wacs.WASI/Wacs.WASI.NN/Wacs.WASI.NN.MLNet/bin/Release/net8.0/Wacs.WASI.NN.MLNet.dll)

wacs run my.component.wasm --wasip2 --bind "$MLNET" -d ./models::/models

--bind auto-pulls the WASI.NN typed surface + DI sibling onto host-packages when the identity starts with Wacs.WASI.NN.. The Preview 2 DI scope wires the ML.NET-backed ORT into the DI bundle's WasiNNConfiguration.Backends[ONNX].

Embedder

Interpreter / one-line:

using Wacs.Core.Runtime;
using Wacs.WASI.NN;
using Wacs.WASI.NN.MLNet;
using Wacs.WASI.NN.Types;

var runtime = new WasmRuntime();
runtime.UseWasiNN(b => b.AddBackend(GraphEncoding.ONNX, new MLNetBackend()));

What it provides

  • MLNetBackend : IBackend — wraps ORT under MLContext.Transforms.ApplyOnnxModel / IDataView, exposing the same LoadGraph(builders, target) / Compute(inputs) shape as the bare ORT backend. Embedders who want the ML.NET preprocessing surface get it; the rest of WACS doesn't notice
  • WasiNNMLNetBindable : IBindable — parameterless adapter for --bind
  • [assembly: WasiHostPackage]

Why ML.NET over bare ORT

Use this backend when:

  • Your wasm guest is one stage in a longer ML.NET pipeline (custom transformers, preprocessing, IDataView consumers) and you want them composed in one host-side process
  • You're already bringing in Microsoft.ML for adjacent work — the marginal cost of routing wasi-nn through MLContext is small
  • You want MLContext.Log / structured ML.NET diagnostics around the inference call

For everything else — image classification, embeddings, encoder-only LLMs, raw tensor in / raw tensor out — bare WACS.WASI.NN.OnnxRuntime is lighter and simpler.

Backend choice

Use case Package
ONNX with ML.NET pipeline integration WACS.WASI.NN.MLNet (this)
Standard ONNX inference (lighter footprint) WACS.WASI.NN.OnnxRuntime
GGUF / llama.cpp generative LLMs WACS.WASI.NN.LlamaSharp

Documentation

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.4 94 5/12/2026
0.2.3 103 5/11/2026
0.2.2 90 5/10/2026
0.2.0 96 5/10/2026