[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7122":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":15,"starSnapshotCount":15,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},7122,"mlx-swift-examples","ml-explore\u002Fmlx-swift-examples","ml-explore","Examples using MLX Swift","",null,"Swift",2590,401,30,0,1,17,42,18,29.81,"MIT License",false,"main",true,[26],"mlx","2026-06-12 02:01:34","# MLX Swift Examples\n\nExample [MLX Swift](https:\u002F\u002Fgithub.com\u002Fml-explore\u002Fmlx-swift) programs.  The language model\nexamples use models implemented in [MLX Swift LM](https:\u002F\u002Fgithub.com\u002Fml-explore\u002Fmlx-swift-lm).\n\n- [MNISTTrainer](Applications\u002FMNISTTrainer\u002FREADME.md): An example that runs on\n  both iOS and macOS that downloads MNIST training data and trains a\n  [LeNet](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FLeNet).\n\n- [LLMBasic](Applications\u002FLLMBasic\u002FREADME.md): A **minimal** LLM chat example\n  application.  It has only two features: load the model and evaluate a prompt.\n\n- [LLMEval](Applications\u002FLLMEval\u002FREADME.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.  It has some preset prompts, tool integration,\n  etc.  Additionally it shows detailed statistics on the run.\n\n- [MLXChatExample](Applications\u002FMLXChatExample\u002FREADME.md): An example chat app that runs on both iOS and macOS that supports LLMs and VLMs.\n\n- [LoRATrainingExample](Applications\u002FLoRATrainingExample\u002FREADME.md): An example that runs on macOS that downloads an LLM and fine-tunes it using LoRA (Low-Rank Adaptation) with training data.\n\n- [LinearModelTraining](Tools\u002FLinearModelTraining\u002FREADME.md): An example that\n  trains a simple linear model.\n\n- [StableDiffusionExample](Applications\u002FStableDiffusionExample\u002FREADME.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\u002Fllm-tool\u002FREADME.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\u002Fimage-tool\u002FREADME.md): A command line tool for generating images\n  using a stable diffusion model from Hugging Face.\n\n- [mnist-tool](Tools\u002Fmnist-tool\u002FREADME.md): A command line tool for training a\n  a LeNet on MNIST.\n  \n> [!IMPORTANT]\n> `MLXLMCommon`, `MLXLLM`, `MLXVLM` and `MLXEmbedders` have moved to a new repository\n> containing _only_ reusable libraries: [mlx-swift-lm](https:\u002F\u002Fgithub.com\u002Fml-explore\u002Fmlx-swift-lm).\n\nPrevious URLs and tags will continue to work, but going forward all updates to these\nlibraries will be done in the other repository.  Previous tags _are_ supported in\nthe new repository.\n\n> [!TIP]\n> Contributors that wish to edit both `mlx-swift-examples` and `mlx-swift-lm` can\n> use [this technique in Xcode](https:\u002F\u002Fdeveloper.apple.com\u002Fdocumentation\u002Fxcode\u002Fediting-a-package-dependency-as-a-local-package).\n\n\n# Reusable Libraries\n\nLLM and VLM implementations are available in [MLX Swift LM](https:\u002F\u002Fgithub.com\u002Fml-explore\u002Fmlx-swift-lm):\n\n- [MLXLLMCommon](https:\u002F\u002Fswiftpackageindex.com\u002Fml-explore\u002Fmlx-swift-lm\u002Fmain\u002Fdocumentation\u002Fmlxlmcommon) -- common API for LLM and VLM\n- [MLXLLM](https:\u002F\u002Fswiftpackageindex.com\u002Fml-explore\u002Fmlx-swift-lm\u002Fmain\u002Fdocumentation\u002Fmlxllm) -- large language model example implementations\n- [MLXVLM](https:\u002F\u002Fswiftpackageindex.com\u002Fml-explore\u002Fmlx-swift-lm\u002Fmain\u002Fdocumentation\u002Fmlxvlm) -- vision language model example implementations\n- [MLXEmbedders](https:\u002F\u002Fswiftpackageindex.com\u002Fml-explore\u002Fmlx-swift-lm\u002Fmain\u002Fdocumentation\u002Fmlxembedders) -- popular Encoders \u002F Embedding models example implementations\n\nMLX Swift Examples also contains a few reusable libraries that can be imported with this code in your `Package.swift` or by referencing the URL in Xcode:\n\n```swift\n.package(url: \"https:\u002F\u002Fgithub.com\u002Fml-explore\u002Fmlx-swift-examples\u002F\", 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: \"StableDiffusion\", package: \"mlx-libraries\")\n    ]),\n```\n\n- [StableDiffusion](https:\u002F\u002Fswiftpackageindex.com\u002Fml-explore\u002Fmlx-swift-examples\u002Fmain\u002Fdocumentation\u002Fstablediffusion) -- SDXL Turbo and Stable Diffusion model example implementations\n- [MLXMNIST](https:\u002F\u002Fswiftpackageindex.com\u002Fml-explore\u002Fmlx-swift-examples\u002Fmain\u002Fdocumentation\u002Fmlxmnist) -- MNIST implementation for all your digit recognition needs\n\n## Running\n\nThe application and command line tool examples can be run from Xcode or from\nthe command line:\n\n```\n.\u002Fmlx-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:\u002F\u002Fswiftpackageindex.com\u002Fml-explore\u002Fmlx-swift\u002Fmain\u002Fdocumentation\u002Fmlx\u002Ftroubleshooting)\n","该项目提供了使用MLX Swift进行机器学习的各种示例程序。核心功能包括训练MNIST数据集上的LeNet模型、基于Hugging Face的LLM和稳定扩散模型生成文本与图像等，支持iOS和macOS双平台运行。技术特点在于其简洁且直接的应用实例，如最小化的LLM聊天应用、详细的模型评估统计展示以及通过LoRA方法微调大语言模型。适用于需要快速上手或展示Swift中机器学习能力的开发者，尤其适合那些希望在Apple生态系统内探索AI技术的人士。",2,"2026-06-11 03:10:38","top_language"]