There is a selection of labs that showcases how to integrate the powerful different versions of Phi-3 models in a .NET environment.
Before running the sample, ensure you have the following installed:
.NET 8: Make sure you have the latest version of .NET installed on your machine.
(Optional) Visual Studio or Visual Studio Code: You will need an IDE or code editor capable of running .NET projects. Visual Studio or Visual Studio Code are recommended.
Using git clone locally one of the available Phi-3 versions from Hugging Face.
Download the phi3-mini-4k-instruct-onnx model to your local machine:
cd c:\phi3\models
git lfs install
git clone https://huggingface.co/microsoft/Phi-3-mini-4k-instruct-onnx
git clone https://huggingface.co/microsoft/Phi-3-vision-128k-instruct-onnx-cpu
Important: The current demos are designed to use the ONNX versions of the model. The previous steps clone the following models.
The main solution have several sample Labs that demonstrates the capabilities of the Phi-3 models using C#.
Project | Description | Location |
---|---|---|
LabsPhi301 | This is a sample project that uses a local phi3 model to ask a question. The project load a local ONNX Phi-3 model using the Microsoft.ML.OnnxRuntime libraries. |
.\src\LabsPhi301\ |
LabsPhi302 | This is a sample project that implement a Console chat using Semantic Kernel. | .\src\LabsPhi302\ |
LabsPhi303 | This is a sample project that uses a local phi3 vision model to analyze images.. The project load a local ONNX Phi-3 Vision model using the Microsoft.ML.OnnxRuntime libraries. |
.\src\LabsPhi303\ |
LabsPhi304 | This is a sample project that uses a local phi3 vision model to analyze images.. The project load a local ONNX Phi-3 Vision model using the Microsoft.ML.OnnxRuntime libraries. The project also presents a menu with different options to interacti with the user. |
.\src\LabsPhi304\ |
LabsPhi305 | This is a sample project that uses a the Phi-3 hosted in ollama model to answer a question. | coming soon |
LabsPhi306 | This is a sample project that implement a Console chat using Semantic Kernel. | coming soon |
LabsPhi307 | This is a sample project that implement a RAG using local embeddings and Semantic Kernel. | coming soon |
To run the projects, follow these steps:
-
Clone the repository to your local machine.
-
Open a terminal and navigate to the desired project. In example, let's run
LabsPhi301
.cd .\src\LabsPhi301\
-
Run the project with the command
dotnet run
-
The sample project ask for a user input and replies using the local mode.
The running demo is similar to this one:
Note: there is a typo in the 1st question, Phi-3 is cool enough to share the correct answer!
-
The project
LabsPhi304
ask for the user to select different options, and then process the request. In example, analyzing a local image.The running demo is similar to this one: