Skip to content

Conversation

@elbruno
Copy link
Contributor

@elbruno elbruno commented Feb 27, 2025

Purpose

This pull request introduces a new set of C# labs to demonstrate the integration of Phi-3 and Phi-4 models in a .NET environment. The changes include the addition of project files, solution configuration, and sample code for various labs.

New Labs and Projects:

  • md/04.HOL/dotnet/csharplabs.md: Added documentation for the Phi-3 labs using C#, including prerequisites, instructions for downloading models, and descriptions of the sample projects.

  • md/04.HOL/dotnet/src/LabsPhi.sln: Created a new Visual Studio solution file that includes multiple projects for the labs. The solution file organizes the Phi-3 and Phi-4 projects, including LabsPhi301, LabsPhi302, LabsPhi303, LabsPhi304, and chat projects LabsPhi4-Chat-01OnnxRuntime and `LabsPhi4-Chat-02SK. These changes provide a comprehensive set of labs to showcase the capabilities of Phi-3 and Phi-4 models in various scenarios using C#

Does this introduce a breaking change?

When developers merge from main and run the server, azd up, or azd deploy, will this produce an error?
If you're not sure, try it out on an old environment.

[ ] Yes
[X] No

Does this require changes to learn.microsoft.com docs?

This repository is referenced by (https://azure.microsoft.com/products/phi-3)
which includes deployment, settings and usage instructions.

[ ] Yes
[X] No

Type of change

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[X] Documentation content changes
[X] Other... Please describe: C# Samples of Phi-3 and Phi-4 models using ONNX
``

DETAILS

- Introduced `LabsPhi.sln` to organize multiple Phi-3 and Phi-4 projects, including `LabsPhi301`, `LabsPhi302`, `LabsPhi303`, `LabsPhi304`, and chat projects `LabsPhi4-Chat-01OnnxRuntime` and `LabsPhi4-Chat-02SK`.
- Updated `README.md` with repository overview, prerequisites, project descriptions, and usage instructions, along with badges for license and social media.
- Created or modified project files for `LabsPhi4-Chat-01OnnxRuntime.csproj` and `LabsPhi4-Chat-02SK.csproj` to include .NET SDK, target framework, and necessary package references for ONNX runtime and Semantic Kernel.
- Added `Program.cs` files for both chat projects, implementing chat functionality with the Phi-4 model, including licensing comments and user input handling.
DETAILS

- Updated `Microsoft.ML.OnnxRuntimeGenAI` and `Microsoft.ML.OnnxRuntimeGenAI.Cuda` to version 0.6.0 in the project file.
- Removed instantiation of `Model` and `Tokenizer` in `Program.cs`.
- Added a farewell message "Bye!" when the user exits the chat loop.
- Updated comments to reflect the use of the new model.
- Changed token processing by appending the first token to the generator instead of setting input sequences.
- Commented out the `generator.ComputeLogits()` call to optimize token generation logic.
DETAILS

The changes introduce a new set of labs for integrating Phi-3 models using C#. The documentation (`csharplabs.md`) has been expanded to include a welcome section, prerequisites for running the samples, and detailed instructions for downloading the necessary models from Hugging Face. The project files for LabsPhi301, LabsPhi302, and LabsPhi303 have been updated to target .NET 8.0 and include necessary package references for ONNX runtime and Semantic Kernel.

Significant enhancements have been made to the `Program.cs` files to implement chat functionalities and image processing capabilities, allowing users to interact with the models more effectively. The `LabsPhi304.csproj` file has been updated with new dependencies and project properties, while the `SpectreConsoleOutput.cs` file has been introduced to encapsulate console output functionalities.

Additionally, a new PNG image file (`foggydaysmall.png`) has been added to enhance the visual resources available for the project.
@github-actions
Copy link
Contributor

Check Broken Paths

We have automatically detected the following broken relative paths in your files.
Review and fix the paths to resolve this issue.

Check the file paths and associated broken paths inside them.
For more details, check our Contributing Guide.

File Full Path Issues
md/04.HOL/dotnet/src/README.md
#LinkLine Number
1./img/10DownloadOnnx.png31
2/src/SemanticKernel.Connectors.OnnxRuntimeGenAI/OnnxRuntimeGenAIKernelBuilderExtensions.cs52
3/src/SemanticKernel.Connectors.OnnxRuntimeGenAI/OnnxRuntimeGenAIKernelBuilderExtensions.cs53
4./img/20SampleConsole.gif75
5./img/30SampleVisionConsole.gif83

@github-actions
Copy link
Contributor

Check Broken URLs

We have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue.

Check the file paths and associated broken URLs inside them.
For more details, check our Contributing Guide.

File Full Path Issues
md/02.Application/02.Code/Phi3/VSCodeExt/README.md
#LinkLine Number
1https://github.com/microsoft/Phi-3CookBook/blob/main/md/01.Introduce/Phi3Family.md11
md/02.Application/02.Code/Phi3/VSCodeExt/HOL/Apple/01.Installations.md
#LinkLine Number
1https://github.com/microsoft/Phi-3CookBook/blob/main/md/03.Inference/MLX_Inference.md49
md/02.Application/02.Code/Phi3/VSCodeExt/HOL/AIPC/01.Installations.md
#LinkLine Number
1https://github.com/microsoft/Phi-3CookBook/blob/main/md/03.Inference/AIPC_Inference.md49
md/01.Introduction/01/01.Edgeandcloud.md
#LinkLine Number
1https://huggingface.co/microsoft/Phi-3-small-128k-instruct-onnx-cuda16
md/04.HOL/dotnet/src/README.md
#LinkLine Number
1https://twitter.com/elbruno4
2https://twitter.com/elbruno96

@github-actions
Copy link
Contributor

Check Broken URLs

We have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue.

Check the file paths and associated broken URLs inside them.
For more details, check our Contributing Guide.

File Full Path Issues
md/02.Application/02.Code/Phi3/VSCodeExt/README.md
#LinkLine Number
1https://github.com/microsoft/Phi-3CookBook/blob/main/md/01.Introduce/Phi3Family.md11
md/02.Application/02.Code/Phi3/VSCodeExt/HOL/Apple/01.Installations.md
#LinkLine Number
1https://github.com/microsoft/Phi-3CookBook/blob/main/md/03.Inference/MLX_Inference.md49
md/02.Application/02.Code/Phi3/VSCodeExt/HOL/AIPC/01.Installations.md
#LinkLine Number
1https://github.com/microsoft/Phi-3CookBook/blob/main/md/03.Inference/AIPC_Inference.md49
md/01.Introduction/01/01.Edgeandcloud.md
#LinkLine Number
1https://huggingface.co/microsoft/Phi-3-small-128k-instruct-onnx-cuda16

@elbruno elbruno closed this by deleting the head repository Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant