mlx-swift-examples  by ml-explore

Swift examples for MLX models

created 1 year ago
1,983 stars

Top 22.6% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides example implementations and tools for using the MLX framework with Swift, targeting developers interested in on-device machine learning for LLMs, VLMs, image generation, and traditional ML tasks. It offers pre-built Swift packages for easy integration into iOS, macOS, and visionOS applications, simplifying the adoption of advanced ML models.

How It Works

The project leverages Swift's native capabilities and the MLX framework to provide efficient, on-device inference and training. It organizes examples into modular Swift packages (e.g., MLXLLM, MLXVLM, StableDiffusion) that can be directly imported into Xcode projects. Command-line tools are also provided for quick experimentation with models like LLMs, Stable Diffusion, and MNIST.

Quick Start & Requirements

  • Install: Add https://github.com/ml-explore/mlx-swift-examples/ as a Swift Package dependency in Xcode or use the mlx-run shell script for command-line tools.
  • Prerequisites: Xcode command-line tools are required for mlx-run.
  • Resources: Examples include MNIST training, LLM text generation, VLM image analysis, and Stable Diffusion image generation.
  • Docs: https://github.com/ml-explore/mlx-swift-examples/

Highlighted Details

  • Cross-platform examples for iOS, macOS, and visionOS.
  • Includes LLM, VLM, Embedders, Stable Diffusion, and MNIST implementations.
  • Command-line tools for LLM, image, and MNIST tasks.
  • Seamless integration as Swift Packages.

Maintenance & Community

The project is part of the ml-explore organization, indicating potential backing and active development.

Licensing & Compatibility

The repository does not explicitly state a license in the provided README. Users should verify licensing for commercial use or closed-source integration.

Limitations & Caveats

The README does not specify licensing, which may pose a barrier for commercial adoption. Some examples might require downloading large models from Hugging Face, impacting initial setup time and storage.

Health Check
Last commit

1 day ago

Responsiveness

1 day

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

Explore Similar Projects

Feedback? Help us improve.