PhiCookBook  by microsoft

Cookbook for Microsoft's Phi SLMs, covering diverse use cases

created 1 year ago
3,459 stars

Top 14.3% on sourcepulse

GitHubView on GitHub
Project Summary

This repository serves as a comprehensive guide and collection of hands-on examples for Microsoft's Phi family of Small Language Models (SLMs). It targets developers and researchers looking to leverage these cost-effective and high-performing models for various generative AI applications, from cloud deployment to edge devices, with limited computing power.

How It Works

The Phi Cookbook provides practical code snippets and tutorials covering the entire lifecycle of using Phi models. It demonstrates inference across diverse environments (cloud, edge, mobile, desktop), quantization techniques for optimization (llama.cpp, ONNX Runtime, OpenVINO, MLX), and evaluation methodologies. The examples showcase building applications for text, chat, vision, and audio, with a strong emphasis on fine-tuning custom Phi models and integrating them into existing workflows.

Quick Start & Requirements

  • Install: Clone the repository (git clone https://github.com/microsoft/PhiCookBook.git). Specific model inference and fine-tuning examples will have their own dependency requirements detailed within their respective directories.
  • Prerequisites: Varies by example; may include Python, specific libraries (e.g., Hugging Face Transformers, ONNX Runtime, PyTorch, TensorFlow), CUDA for GPU acceleration, and potentially cloud platform SDKs (Azure).
  • Resources: Setup time and resource footprint depend heavily on the specific examples and models used. Running larger Phi models locally may require significant RAM and GPU VRAM.
  • Links:

Highlighted Details

  • Extensive multi-language support demonstrated.
  • Covers inference on a wide range of platforms including iOS, Android, Jetson, and AI PCs.
  • Detailed sections on model quantization for performance optimization.
  • Examples for multimodal applications (vision, audio) and advanced features like Mixture of Experts (MoE) and Function Calling.
  • Strong focus on Responsible AI principles and integration with Azure AI services.

Maintenance & Community

  • Developed and maintained by Microsoft.
  • Encourages community engagement via a Discord server (link not provided).
  • The project structure suggests ongoing development with recent additions marked with "🆕".

Licensing & Compatibility

  • The Phi models themselves are open-source. Specific licensing details for the models are not detailed in this README, but Microsoft's open-source AI models typically have permissive licenses.
  • The cookbook repository itself is likely under a standard open-source license (e.g., MIT), but this is not explicitly stated. Compatibility for commercial use would depend on the specific Phi model licenses.

Limitations & Caveats

The README does not explicitly state limitations or caveats regarding the Phi models or the cookbook's examples. Users should be aware that performance and capabilities can vary significantly based on the specific Phi model version and the hardware used for inference and fine-tuning.

Health Check
Last commit

1 week ago

Responsiveness

1 day

Pull Requests (30d)
16
Issues (30d)
24
Star History
241 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.