[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7077":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":9,"pushedAt":9,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":27,"discoverSource":28},7077,"swift-coreml-diffusers","huggingface\u002Fswift-coreml-diffusers","huggingface","Swift app demonstrating Core ML Stable Diffusion",null,"Swift",2752,238,38,39,0,2,5,60.64,"Apache License 2.0",false,"main",true,[],"2026-06-12 04:00:32","#  Swift Core ML Diffusers 🧨\n\nThis is a native app that shows how to integrate Apple's [Core ML Stable Diffusion implementation](https:\u002F\u002Fgithub.com\u002Fapple\u002Fml-stable-diffusion) in a native Swift UI application. The Core ML port is a simplification of the Stable Diffusion implementation from the [diffusers library](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fdiffusers). This application can be used for faster iteration, or as sample code for any use cases.\n\nThis is what the app looks like on macOS:\n![App Screenshot](screenshot.jpg)\n\nOn first launch, the application downloads a zipped archive with a Core ML version of Stability AI's Stable Diffusion v2 base, from [this location in the Hugging Face Hub](https:\u002F\u002Fhuggingface.co\u002Fpcuenq\u002Fcoreml-stable-diffusion-2-base\u002Ftree\u002Fmain). This process takes a while, as several GB of data have to be downloaded and unarchived.\n\nFor faster inference, we use a very fast scheduler: [DPM-Solver++](https:\u002F\u002Fgithub.com\u002FLuChengTHU\u002Fdpm-solver), that we ported to Swift from our [diffusers DPMSolverMultistepScheduler implementation](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fdiffusers\u002Fblob\u002Fmain\u002Fsrc\u002Fdiffusers\u002Fschedulers\u002Fscheduling_dpmsolver_multistep.py).\n\nThe app supports models quantized with `coremltools` version 7 or better. This requires macOS 14 or iOS\u002FiPadOS 17.\n\n## Compatibility and Performance\n\n- macOS Ventura 13.1, iOS\u002FiPadOS 16.2, Xcode 14.2.\n- Performance (after the initial generation, which is slower)\n  * ~8s in macOS on MacBook Pro M1 Max (64 GB). Model: Stable Diffusion v2-base, ORIGINAL attention implementation, running on CPU + GPU.\n  * 23 ~ 30s on iPhone 13 Pro. Model: Stable Diffusion v2-base, SPLIT_EINSUM attention, CPU + Neural Engine, memory reduction enabled.\n\nSee [this post](https:\u002F\u002Fhuggingface.co\u002Fblog\u002Ffast-mac-diffusers) and [this issue](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fswift-coreml-diffusers\u002Fissues\u002F31) for additional performance figures.\n\nQuantized models run faster, but they require macOS Ventura 14, or iOS\u002FiPadOS 17.\n\nThe application will try to guess the best hardware to run models on. You can override this setting using the `Advanced` section in the controls sidebar.\n\n## How to Run\n\nThe easiest way to test the app on macOS is by [downloading it from the Mac App Store](https:\u002F\u002Fapps.apple.com\u002Fapp\u002Fdiffusers\u002Fid1666309574).\n\n## How to Build\n\nYou need [Xcode](https:\u002F\u002Fdeveloper.apple.com\u002Fxcode\u002F) to build the app. When you clone the repo, please update `common.xcconfig` with your development team identifier. Code signing is required to run on iOS, but it's currently disabled for macOS.\n\n## Known Issues\n\nPerformance on iPhone is somewhat erratic, sometimes it's ~20x slower and the phone heats up. This happens because the model could not be scheduled to run on the Neural Engine and everything happens in the CPU. We have not been able to determine the reasons for this problem. If you observe the same, here are some recommendations:\n- Detach from Xcode\n- Kill apps you are not using.\n- Let the iPhone cool down before repeating the test.\n- Reboot your device.\n\n## Next Steps\n\n- Allow additional models to be downloaded from the Hub.\n","该项目是一个演示如何在原生Swift UI应用程序中集成Apple的Core ML Stable Diffusion实现的应用。其核心功能包括通过简化Hugging Face diffusers库中的Stable Diffusion模型来实现在iOS、iPadOS以及macOS平台上运行文本到图像生成模型，并采用了DPM-Solver++调度器以加速推理过程。该应用支持使用coremltools 7或更高版本量化的模型，特别适用于需要快速迭代AI生成内容的场景，如艺术创作、设计原型制作等。此外，项目还提供了详细的构建指南和已知问题列表，帮助开发者更好地理解和使用这一技术。","2026-06-11 03:10:24","top_language"]