Skip to content

A MacOS application showcasing Microsoft's Phi4 LLM running locally with MLX Model Manager

License

Notifications You must be signed in to change notification settings

kunal732/mlx-swift-phi4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phi-4 macOS App with MLX Model Manager

Phi-4 Demo Screenshot
Screenshot of the macOS app running alongside mactop

A sample Swift (macOS) application demonstrating how to download, load, and run Microsoft’s Phi-4 language model using the MLX Model Manager. The app provides a simple SwiftUI interface for prompting Phi-4 and viewing text completions.

Table of Contents

  1. Overview
  2. Features
  3. Requirements
  4. Installation
  5. Usage
  6. License
  7. Additional Resources

Overview

Phi-4 is a small language model developed by Microsoft, focusing on providing concise and domain-specific completions. By integrating MLX Model Manager, this app manages the download, caching, and inference process for the Phi-4 model in a streamlined manner.


Features

  • Easy Model Management: Downloads and loads the Phi-4 model via MLX Model Manager.
  • Simple SwiftUI Interface: Prompt the model and view generated text completions.
  • Progress Indicators: Displays download progress and generation progress.
  • Markdown-Enabled Output: Displays model output in Markdown format.

Requirements

  • macOS 14 (Sonoma) or later
  • Xcode 14 or later
  • An internet connection (for initial model download)

Installation

  1. Clone this repository (or download the ZIP and unzip locally):

    git clone https://github.com/kunal732/mlx-swift-phi4
    cd phi4-macos-demo
  2. Open the project in Xcode:

    open phi4-macos-demo.xcodeproj
  3. Resolve Swift Package Dependencies:
    Xcode should automatically fetch the MLX Model Manager package from GitHub.

  4. Build & Run in Xcode:

    • Select the macOS scheme (e.g., phi4-macos-demo)
    • Press Cmd+R (or click the Play button)

Usage

  1. When you launch the app, it will attempt to download the Phi-4 model automatically if it’s not already on your machine.
  2. Once the download completes, the Answer Prompt button becomes active.
  3. Enter any prompt (e.g., “Why is the sky blue?”) in the text field.
  4. Press Return or click Answer Prompt to generate a completion using Phi-4.
  5. Observe the progress indicator if the model is still loading or generating text.

License

This sample app is provided under the MIT License. Microsoft’s Phi-4 model usage may be subject to additional terms. Refer to the Microsoft blog post for details on licensing and usage constraints of Phi-4.


Additional Resources

Enjoy experimenting with Phi-4 on macOS! If you encounter issues, open an Issue or submit a Pull Request. Contributions are welcome.

About

A MacOS application showcasing Microsoft's Phi4 LLM running locally with MLX Model Manager

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages