Onnxify is an experimental .NET library for reading, inspecting, and writing ONNX models.
Machine learning workflows are often difficult not because models are impossible to run, but because they are difficult to understand, inspect, adapt, and carry from one environment to another. A lot of useful work happens in that space between research and production, where people need clarity, control, and confidence rather than another opaque black box. Onnxify exists for that middle ground.
The idea behind this repository is simple: models should be easier to work with, easier to reason about, and easier to integrate into real development workflows. If ONNX is meant to be a common language for models, then the tools around it should help people move faster, make smaller changes safely, and build their own workflows without unnecessary friction. That is the direction Onnxify is trying to push.
New models created with OnnxModel.Create() default to standard ONNX opset 25 and IR version 11. The opset default tracks the current bundled standard-domain operator schemas, while IR 11 remains compatible with the ONNX Runtime version used by the repository tests. Override OnnxModelCreationOptions.Opset and IrVersion when targeting an older runtime or a specific deployment profile.
The repository currently implements the following NuGet packages. Package-specific instructions live in .docs/nuget.
| Labrary | NuGet Package |
|---|---|
Onnxify |
|
Onnxify.TorchSharp |
|
Onnxify.Safetensors |
|
Onnxify.ProjectGenerator |
|
Onnxify.ModelGenerator |
|
Onnxify.ML |
|
Onnxify.ML.TorchSharp |
|
Onnxify.HuggingFace |
|
Onnxify.CLI |
Onnxify.ModelGenerator can generate typed Microsoft.ML.OnnxRuntime inference wrappers for .onnx files included in a consuming project. Generated OnnxRuntimeInference wrappers now include both synchronous Run(...) overloads and async RunAsync(...) overloads with CancellationToken support. The async path uses ONNX Runtime's real InferenceSession.RunAsync(...) OrtValue buffer API rather than wrapping synchronous inference in Task.Run(...).
See TORCH_OPERATOR_COVERAGE.md for the current TorchSharp operator support matrix across ONNX import and export features.
- .NET 8 SDK + .NET 10 SDK
- Windows 11 or Linux-based system
- NuGet packages are cross-platform for consumer projects
Clone the repository and build the solution.
Windows:
git clone --recurse-submodules https://github.com/gluschenko/onnxify.git
cd onnxify
dotnet build src\Onnxify.slnxLinux:
git clone --recurse-submodules https://github.com/gluschenko/onnxify.git
cd onnxify
dotnet build src/Onnxify.slnxTo pack and install the local Onnxify.CLI tool from this repository:
Windows:
.\install-onnxify-cli.ps1Linux:
chmod +x ./install-onnxify-cli.sh
./install-onnxify-cli.shTo install or refresh the bundled Codex skills from this repository:
Windows:
.\install-onnxify-skills.ps1Linux:
chmod +x ./install-onnxify-skills.sh
./install-onnxify-skills.shBoth install scripts support help output:
Windows:
.\install-onnxify-cli.ps1 -Help
.\install-onnxify-skills.ps1 -HelpLinux:
./install-onnxify-cli.sh --help
./install-onnxify-skills.sh --helpThis section is optional. If you only want to consume the NuGet packages in your own .NET project, you do not need the Codex skill.
If you use Codex and want repository-specific help for Onnxify, Onnxify.TorchSharp, and the related package family, you can install the bundled onnxify skill directly from GitHub without cloning the repository.
Windows:
$codexHome = if ($env:CODEX_HOME) { $env:CODEX_HOME } else { Join-Path $HOME ".codex" }
py -3 "$codexHome\skills\.system\skill-installer\scripts\install-skill-from-github.py" `
--repo gluschenko/onnxify `
--path .agents/skills/onnxifyLinux:
codex_home="${CODEX_HOME:-$HOME/.codex}"
python3 "$codex_home/skills/.system/skill-installer/scripts/install-skill-from-github.py" \
--repo gluschenko/onnxify \
--path .agents/skills/onnxifyYou can also install it by URL instead of --repo and --path.
Windows:
$codexHome = if ($env:CODEX_HOME) { $env:CODEX_HOME } else { Join-Path $HOME ".codex" }
py -3 "$codexHome\skills\.system\skill-installer\scripts\install-skill-from-github.py" `
--url "https://github.com/gluschenko/onnxify/tree/main/.agents/skills/onnxify"Linux:
codex_home="${CODEX_HOME:-$HOME/.codex}"
python3 "$codex_home/skills/.system/skill-installer/scripts/install-skill-from-github.py" \
--url "https://github.com/gluschenko/onnxify/tree/main/.agents/skills/onnxify"If you already cloned this repository and want to install both bundled skills from the local checkout, use the install-onnxify-skills.ps1 or install-onnxify-skills.sh scripts shown in Getting Started.
Restart Codex after installation so it picks up the new or refreshed skill files.
This repository is licensed under the terms of the LICENSE file.
