| ### 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 understanding | |
| - `whisper-small-en\` - Whisper speech recognition model for English audio processing | |
| - `yolov8\` - 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 models | |
| - `open-ai-npu-clip\ClipInference.cs` - Runs clip inference using both models. Latency measurements and looping enabled. | |
| - `whisper-small-en\Program.cs` - Whisper model inference example | |
| - `yolov8\Program.cs` - YOLOv8 model inference example | |
| #### Prerequisites | |
| 1. Download and unzip the file containing the Nuget packages provided by AMD | |
| 2. Clone the hugging face repository containing the application code, models, and cache | |
| 3. `cd` into the cloned repo | |
| 4. Create a directory for the Nuget packages inside the repo | |
| ```bash | |
| mkdir nupkgs | |
| ``` | |
| 5. Copy the contents of the unzipped Nuget packages to the nupkgs directory | |
| 6. 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 | |
| 1. 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 | |
| 2. Change into the project directory | |
| ```bash | |
| cd whisper_project | |
| ``` | |
| 3. 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 | |
| 1. Modify the `Program.cs` source code file in the `src\whisper-small-en` directory, replacing the paths that reference models and cache locations to the actual paths on your system. | |
| 2. 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 . | |
| ``` | |
| 3. Build the project | |
| ``` | |
| dotnet build | |
| ``` | |
| 4. Run the project | |
| ``` | |
| dotnet run | |
| ``` | |
| * To run another example, repeat `Instructions to create a new project` and `Instructions to run the provided examples` steps with different project names and source code files. | |