elbruno / phi3-labs

C# labs using the Phi3 model
MIT License
8 stars 2 forks source link

Labs using Phi-3 and Phi-3-Vision

License: MIT Twitter: elbruno GitHub: elbruno

Welcome to the Phi-3 samples using C#. This repository contains a set of demo projects that showcases how to integrate the powerful different versions of Phi-3 models in a .NET environment.

Prerequisites

Before running the sample, ensure you have the following installed:

You can learn more about Phi-3 in Hugging Face.

About the Samples

The main solution have several sample projects that demonstrates the capabilities of the Phi-3 models.

Microsoft ML ONNX Runtime Samples

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\
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\

Semantic Kernel Samples

Project Description Location
LabsPhi3_sk01 This is a sample project that uses a local phi3 model to ask a question. The project uses Semantic Kernel and SemanticKernel.Connectors.OnnxRuntimeGenAI to load a local Phi-3 model and implement a console chat. .\src\LabsPhi3_sk01\
LabsPhi3_sk02 This is a sample project that uses a local phi3 model to ask a question. The project uses Semantic Kernel and a local copy of the source code and project SemanticKernel.Connectors.OnnxRuntimeGenAI to load a local Phi-3 model and implement a console chat. .\src\LabsPhi3_sk02\
LabsPhi3_sk03 The project uses Semantic Kernel and the local copy of the source code and project SemanticKernel.Connectors.OnnxRuntimeGenAI to load a local Phi-3 Vision model and analyzes and describes an image. .\src\LabsPhi3_sk03\

How to Run the Projects

To run the projects, follow these steps:

  1. Clone the repository to your local machine.

  2. Open a terminal and navigate to the desired project. In example, let's run LabsPhi301.

    cd .\src\LabsPhi301\
  3. Run the project with the command

    dotnet run
  4. The sample project ask for a user input and replies using the local mode.

    The running demo is similar to this one:

    Chat running demo

    Note: there is a typo in the 1st question, Phi-3 is cool enough to share the correct answer!

  5. 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:

    Image Analysis running demo

References

Author

👤 Bruno Capuano

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2024 Bruno Capuano.

This project is MIT licensed.