{"id":13694150,"url":"https://github.com/ml-explore/mlx-swift-examples","last_synced_at":"2025-05-14T09:07:42.123Z","repository":{"id":223938086,"uuid":"761903377","full_name":"ml-explore/mlx-swift-examples","owner":"ml-explore","description":"Examples using MLX Swift","archived":false,"fork":false,"pushed_at":"2025-05-12T19:33:28.000Z","size":584,"stargazers_count":1778,"open_issues_count":46,"forks_count":225,"subscribers_count":27,"default_branch":"main","last_synced_at":"2025-05-12T20:47:09.898Z","etag":null,"topics":["mlx"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ml-explore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-22T17:47:37.000Z","updated_at":"2025-05-12T19:33:30.000Z","dependencies_parsed_at":"2024-06-11T00:44:12.573Z","dependency_job_id":"832b3025-86f9-48ac-81d8-2e0172d50778","html_url":"https://github.com/ml-explore/mlx-swift-examples","commit_stats":{"total_commits":118,"total_committers":26,"mean_commits":4.538461538461538,"dds":0.4576271186440678,"last_synced_commit":"8cdc4a065a153bd0af7f1309eb8d5418f014e046"},"previous_names":["ml-explore/mlx-swift-examples"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ml-explore%2Fmlx-swift-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ml-explore%2Fmlx-swift-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ml-explore%2Fmlx-swift-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ml-explore%2Fmlx-swift-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ml-explore","download_url":"https://codeload.github.com/ml-explore/mlx-swift-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253822626,"owners_count":21969832,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mlx"],"created_at":"2024-08-02T17:01:25.493Z","updated_at":"2025-05-14T09:07:42.107Z","avatar_url":"https://github.com/ml-explore.png","language":"Swift","readme":"# Documentation\n\nDevelopers can use these examples in their own programs -- just import the swift package!\n\n- [Porting and implementing models](https://swiftpackageindex.com/ml-explore/mlx-swift-examples/main/documentation/mlxlmcommon/porting)\n- [MLXLLMCommon](https://swiftpackageindex.com/ml-explore/mlx-swift-examples/main/documentation/mlxlmcommon) -- common API for LLM and VLM\n- [MLXLLM](https://swiftpackageindex.com/ml-explore/mlx-swift-examples/main/documentation/mlxllm) -- large language model example implementations\n- [MLXVLM](https://swiftpackageindex.com/ml-explore/mlx-swift-examples/main/documentation/mlxvlm) -- vision language model example implementations\n- [MLXEmbedders](https://swiftpackageindex.com/ml-explore/mlx-swift-examples/main/documentation/mlxembedders) -- popular Encoders / Embedding models example implementations\n- [StableDiffusion](https://swiftpackageindex.com/ml-explore/mlx-swift-examples/main/documentation/stablediffusion) -- SDXL Turbo and Stable Diffusion mdeol example implementations\n- [MLXMNIST](https://swiftpackageindex.com/ml-explore/mlx-swift-examples/main/documentation/mlxmnist) -- MNIST implementation for all your digit recognition needs\n\n# MLX Swift Examples\n\nExample [MLX Swift](https://github.com/ml-explore/mlx-swift) programs.\n\n- [MNISTTrainer](Applications/MNISTTrainer/README.md): An example that runs on\n  both iOS and macOS that downloads MNIST training data and trains a\n  [LeNet](https://en.wikipedia.org/wiki/LeNet).\n\n- [LLMEval](Applications/LLMEval/README.md): An example that runs on both iOS\n  and macOS that downloads an LLM and tokenizer from Hugging Face and\n  generates text from a given prompt.\n\n- [VLMEval](Applications/VLMEval/README.md): An example that runs on iOS, macOS and visionOS to download a VLM and tokenizer from Hugging Face and\n  analyzes the given image and describe it in text.\n\n- [MLXChatExample](Applications/MLXChatExample/README.md): An example chat app that runs on both iOS and macOS that supports LLMs and VLMs.\n\n- [LinearModelTraining](Tools/LinearModelTraining/README.md): An example that\n  trains a simple linear model.\n\n- [StableDiffusionExample](Applications/StableDiffusionExample/README.md): An\n  example that runs on both iOS and macOS that downloads a stable diffusion model\n  from Hugging Face and  and generates an image from a given prompt.\n\n- [llm-tool](Tools/llm-tool/README.md): A command line tool for generating text\n  using a variety of LLMs available on the Hugging Face hub.\n\n- [image-tool](Tools/image-tool/README.md): A command line tool for generating images\n  using a stable diffusion model from Hugging Face.\n\n- [mnist-tool](Tools/mnist-tool/README.md): A command line tool for training a\n  a LeNet on MNIST.\n\n## Running\n\nThe application and command line tool examples can be run from Xcode or from\nthe command line:\n\n```\n./mlx-run llm-tool --prompt \"swift programming language\"\n```\n\nNote: `mlx-run` is a shell script that uses `xcode` command line tools to\nlocate the built binaries.  It is equivalent to running from Xcode itself.\n\nSee also:\n\n- [MLX troubleshooting](https://swiftpackageindex.com/ml-explore/mlx-swift/main/documentation/mlx/troubleshooting)\n\n## Installation of libraries\n\nThe MLXLLM, MLXVLM, MLXLMCommon, MLXMNIST, MLXEmbedders, and StableDiffusion libraries in the example repo are available\nas Swift Packages.\n\n\nAdd the following dependency to your Package.swift\n\n```swift\n.package(url: \"https://github.com/ml-explore/mlx-swift-examples/\", branch: \"main\"),\n```\n\nThen add one or more libraries to the target as a dependency:\n\n```swift\n.target(\n    name: \"YourTargetName\",\n    dependencies: [\n        .product(name: \"MLXLLM\", package: \"mlx-swift-examples\")\n    ]),\n```\n\nAlternatively, add `https://github.com/ml-explore/mlx-swift-examples/` to the `Project Dependencies` and set the `Dependency Rule` to `Branch` and `main` in Xcode.\n","funding_links":[],"categories":["Sample","Swift","Repos","HarmonyOS","MLX Swift","Core MLX \u0026 Examples"],"sub_categories":["RSS","Windows Manager","2024"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fml-explore%2Fmlx-swift-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fml-explore%2Fmlx-swift-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fml-explore%2Fmlx-swift-examples/lists"}