File size: 3,907 Bytes
fae7d99 693fb72 fae7d99 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | ---
license: creativeml-openrail-m
tags:
- text-to-image
- stable-diffusion
- dreamshaper
- lcm
- latent-consistency-model
- coreml
- apple-neural-engine
- palettized
- tokforge
base_model:
- Lykon/dreamshaper-8-lcm
pipeline_tag: text-to-image
library_name: ml-stable-diffusion
---
## TokForge
- **Website:** https://tokforge.ai
- **Discord:** https://discord.gg/Acv3CBtfVm
- **Google Play:** https://play.google.com/store/apps/details?id=dev.tokforge
- **iOS TestFlight:** https://testflight.apple.com/join/jnufjzRr
Runs on-device in the TokForge app.
# TokForge — DreamShaper 8 LCM · CoreML 6-bit (Apple Neural Engine)
A **6-bit palettized Apple CoreML** conversion of **DreamShaper 8 LCM**
([Lykon/dreamshaper-8-lcm](https://huggingface.co/Lykon/dreamshaper-8-lcm), Lykons SD-1.5
DreamShaper 8 finetuned for **Latent Consistency** few-step sampling), built for on-device
image generation in the **[TokForge](https://tokforge.ai)** iOS app. Converted with Apple
**[`ml-stable-diffusion`](https://github.com/apple/ml-stable-diffusion)** (`torch2coreml`)
using **`SPLIT_EINSUM_V2`** attention and **`--quantize-nbits 6`** (6-bit palettized weights),
so it compiles **fast on the Apple Neural Engine** — the fast slot in the TokForge model set.
Part of the **[TokForge iOS · CoreML Image Models](https://huggingface.co/collections/darkmaniac7/tokforge-ios-coreml-image-models-6a38cca9b57803e6168ce232)** collection.
## Files
| File | Size | Contents |
|------|------|----------|
| `Resources/` | ~913 MB | `TextEncoder.mlmodelc` / `Unet.mlmodelc` / `VAEDecoder.mlmodelc` / `VAEEncoder.mlmodelc` + `vocab.json` + `merges.txt` |
The `Resources/` tree holds the compiled `.mlmodelc` models plus the CLIP `vocab.json` +
`merges.txt` — the exact layout Apples `StableDiffusionPipeline` (and the TokForge installer)
loads.
## Recommended render settings (LCM)
```
attention: split_einsum_v2 (Apple Neural Engine)
compute: .cpuAndNeuralEngine (palettized -> fast ANE compile)
steps: 10-15 (works with the stock scheduler today; drops to 4-8 once an
LCM scheduler ships — apple/ml-stable-diffusion #319)
cfg-scale: 1.5-2.0 (LCM prefers low guidance)
resolution: 512x512 (SD-1.5 native; baked into the compiled model)
```
## How this was built
1. Loaded `Lykon/dreamshaper-8-lcm` (SD-1.5 diffusers format, LCM-finetuned UNet).
2. Converted UNet + text encoder + VAE decoder + VAE encoder to CoreML with Apple
`ml-stable-diffusion` `python_coreml_stable_diffusion.torch2coreml`,
`--attention-implementation SPLIT_EINSUM_V2`.
3. Applied **6-bit palettization** (`--quantize-nbits 6`).
4. Bundled the compiled resources for the Swift CLI (`--bundle-resources-for-swift-cli`).
Conversion peaked at ~9.9 GB RAM (no `--chunk-unet` needed). Runs on iOS **17+** (6-bit
palettized weights require the iOS-17 ANE runtime); on iOS-16 the app falls back to an FP16 model.
## License & attribution
- **License:** [CreativeML OpenRAIL-M](https://huggingface.co/spaces/CompVis/stable-diffusion-license),
inherited from DreamShaper 8 LCM / Stable Diffusion 1.5. Use is subject to the OpenRAIL-M restrictions.
- **Base model:** **DreamShaper 8 LCM** by **Lykon** —
https://huggingface.co/Lykon/dreamshaper-8-lcm. All credit for the model weights is Lykons.
- **Conversion tooling:** Apple **`ml-stable-diffusion`** —
https://github.com/apple/ml-stable-diffusion (6-bit palettization, `SPLIT_EINSUM_V2` attention).
- Built on top of Stable Diffusion 1.5 (Runway/CompVis/Stability).
This repository is a **redistribution for on-device use** — a format conversion (PyTorch ->
CoreML) and 6-bit palettization of Lykons DreamShaper 8 LCM. No weights were retrained. The
original OpenRAIL-M terms and attribution requirements propagate to this conversion and any
images generated with it. No additional restrictions are imposed by this repackaging.
|