![]() |
VOOZH | about |
dotnet add package OnnxStack.Core --version 0.9.0
NuGet\Install-Package OnnxStack.Core -Version 0.9.0
<PackageReference Include="OnnxStack.Core" Version="0.9.0" />
<PackageVersion Include="OnnxStack.Core" Version="0.9.0" />Directory.Packages.props
<PackageReference Include="OnnxStack.Core" />Project file
paket add OnnxStack.Core --version 0.9.0
#r "nuget: OnnxStack.Core, 0.9.0"
#:package OnnxStack.Core@0.9.0
#addin nuget:?package=OnnxStack.Core&version=0.9.0Install as a Cake Addin
#tool nuget:?package=OnnxStack.Core&version=0.9.0Install as a Cake Tool
OnnxStack.Core is a library that provides higher-level ONNX services for use in .NET applications. It offers extensive support for features such as dependency injection, .NET configuration implementations, ASP.NET Core integration, and IHostedService support.
You can configure a model set for runtime, offloading individual models to different devices to make better use of resources or run on lower-end hardware. The first use-case is StableDiffusion; however, it will be expanded, and other model sets, such as object detection and classification, will be added.
OnnxStack.Core can be found via the nuget package manager, download and install it.
PM> Install-Package OnnxStack.Core
You can easily integrate OnnxStack.Core into your application services layer. This registration process sets up the necessary services and loads the appsettings.json configuration.
Example: Registering OnnxStack
builder.Services.AddOnnxStack();
The appsettings.json is the easiest option for configuring model sets. Below is an example of clip tokenizer.
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"OnnxStackConfig": {
"OnnxModelSets": [
{
"Name": "ClipTokenizer",
"IsEnabled": true,
"DeviceId": 0,
"InterOpNumThreads": 0,
"IntraOpNumThreads": 0,
"ExecutionMode": "ORT_SEQUENTIAL",
"ExecutionProvider": "DirectML",
"ModelConfigurations": [
{
"Type": "Tokenizer",
"OnnxModelPath": "cliptokenizer.onnx"
},
]
}
]
}
}
// Tokenizer model Example
//----------------------//
// From DI
OnnxStackConfig _onnxStackConfig;
IOnnxModelService _onnxModelService;
// Get Model
var model = _onnxStackConfig.OnnxModelSets.First();
// Get Model Metadata
var metadata = _onnxModelService.GetModelMetadata(model, OnnxModelType.Tokenizer);
// Create Input
var text = "Text To Tokenize";
var inputTensor = new DenseTensor<string>(new string[] { text }, new int[] { 1 });
// Create Inference Parameters container
using (var inferenceParameters = new OnnxInferenceParameters(metadata))
{
// Set Inputs and Outputs
inferenceParameters.AddInputTensor(inputTensor);
inferenceParameters.AddOutputBuffer();
// Run Inference
using (var results = _onnxModelService.RunInference(model, OnnxModelType.Tokenizer, inferenceParameters))
{
// Extract Result
var resultData = results[0].ToDenseTensor();
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|