Code Monkey home page Code Monkey logo

mlx-swift-examples's Introduction

MLX Swift Examples

Example MLX Swift programs.

  • MNISTTrainer: An example that runs on both iOS and macOS that downloads MNIST training data and trains a LeNet.

  • LLMEval: An example that runs on both iOS and macOS that downloads an LLM and tokenizer from Hugging Face and generates text from a given prompt.

  • LinearModelTraining: An example that trains a simple linear model.

  • llm-tool: A command line tool for generating text using a variety of LLMs available on the Hugging Face hub.

  • mnist-tool: A command line tool for training a LeNet on MNIST.

Running

The application and command line tool examples can be run from Xcode or from the command line:

./mlx-run llm-tool --prompt "swift programming language"

See also:

Installation of MLXLLM and MLXMNIST libraries

The MLXLLM and MLXMNIST libraries in the example repo are available as Swift Packages.

Add the following dependency to your Package.swift

.package(url: "https://github.com/ml-explore/mlx-swift-examples/", branch: "main"),

Then add one library or both libraries to the target as a dependency.

.target(
    name: "YourTargetName",
    dependencies: [
        .product(name: "LLM", package: "mlx-swift-examples")
    ]),

Alternatively, add https://github.com/ml-explore/mlx-swift-examples/ to the Project Dependencies and set the Dependency Rule to Branch and main in Xcode.

mlx-swift-examples's People

Contributors

davidkoski avatar mzbac avatar depasqualeorg avatar 1-ashraful-islam avatar awni avatar maiqingqiang avatar derekelewis avatar florentmorin avatar eltociear avatar cresmoon avatar madroidmaq avatar pcuenca avatar ronaldmannak avatar rounak avatar rudro avatar smdesai avatar nathanrchn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.