| ### 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 | |
| - **RyzenAI-clip-vit-base-patch16-NPU**: Contains clip model (patch 16) for NPU: | |
| - `/models/clip_text_model.onnx` - CLIP model for handling text | |
| - `/models/clip_vision_model.onnx` - CLIP model for handling vision | |
| - `/models/clip_text_cache` - pre-compiled cache for the text model | |
| - `/models/clip_vision_cache` - pre-compiled cache for the ficion model | |
| - `/src/Program.cs/` - Contains C# source code for running clip inference using the CLIP-vit-base-patch16 model: | |
| #### 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 clip_project | |
| ``` | |
| a new directory named `clip_project` will be created | |
| 2. Change into the project directory | |
| ```bash | |
| cd clip_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 | |
| ### Instructions to run the provided examples | |
| 1. Modify the `Program.cs` source code file in the `RyzenAI-clip-vit-base-patch16-NPU/src` directory, replacing the paths that reference models and cache locations to the actual paths on your system. | |
| 2. Copy the `Program.cs` file from the `src` directory to the project directory created in the previous steps. | |
| ``` | |
| Copy ..\src\Program.cs . | |
| ``` | |
| 3. Build the project | |
| ``` | |
| dotnet build | |
| ``` | |
| 4. Run the project | |
| ``` | |
| dotnet run | |
| ``` | |