C# ORT Inference using VITISAI EP
This document describes how to set up C# ORT inference using VITISAI EP, with the AMD provided Nuget packages.
Structure of the repository
models/: Contains pre-trained AI models and their configurations for three different use cases:
open-ai-npu-clip\
- CLIP text and vision models for image-text understandingwhisper-small-en\
- Whisper speech recognition model for English audio processingyolov8\
- YOLOv8 object detection model for computer vision tasks
src/: Contains C# source code examples demonstrating ONNX Runtime inference:
open-ai-npu-clip\Program.cs
- Runs inference using the clip models as stand alone modelswhisper-small-en\Program.cs
- Whisper model inference exampleyolov8\Program.cs
- YOLOv8 model inference example
Prerequisites
- Download and unzip the file containing the Nuget packages provided by AMD
- Clone the hugging face repository containing the application code, models, and cache
cd
into the cloned repo- Create a directory for the Nuget packages inside the repo
mkdir nupkgs
Copy the contents of the unzipped Nuget packages to the nupkgs directory
If dotnet is not installed, install using the executable from https://builds.dotnet.microsoft.com/dotnet/Sdk/9.0.305/dotnet-sdk-9.0.305-win-x64.exe
Instructions to create a new project
- From inside the cloned repo, create a new console application
dotnet.exe new console -n whisper_project
a new directory named whisper_project
will be created
- Change into the project directory
cd whisper_project
- Add the required Nuget packages to the project
dotnet add package System.Memory --version 4.6.3
dotnet add package System.Numerics.Tensors --version 9.0.9
dotnet add package Microsoft.ML.OnnxRuntime.Managed --version 1.23.0-dev-20250928-1204-d70213d40e --source path_to_nupkgs
dotnet add package RyzenAI_Deployment --version 1.6.0 --source path_to_nupkgs
- The version numbers of the packages may change, please check the nupkgs directory for the correct version numbers.
- The path_to_nupkgs should be replaced with the actual path to the nupkgs directory created in step
whisper_project
is just an example
Instructions to run the provided examples
Modify the
Program.cs
source code file in thesrc\whisper-small-en
directory, replacing the paths that reference models and cache locations to the actual paths on your system.Copy the source code file from the
src
directory to the project directory created in the previous steps.
Copy ..\src\whisper-small-en\Program.cs .
- Build the project
dotnet build
- Run the project
dotnet run
- To run another example, repeat
Instructions to create a new project
andInstructions to run the provided examples
steps with different project names and source code files.
- Downloads last month
- 12