# Stable Diffusion 1.5 LCM Inpainting — CoreML (SHxTLxST) CoreML `.mlpackage` versions of [SimianLuo/LCM_Dreamshaper_v7](https://huggingface.co/SimianLuo/LCM_Dreamshaper_v7) configured for inpainting, palettized per Apple's LCM recommendation (TextEncoder/VAE at 6-bit, UNet at 8-bit). Used by [SHxTLxST](https://github.com/byteReactr/SHxTLxST) iOS app for lifestyle image generation from masked product photos. ## Submodels | Submodel | nbits | Size | Purpose | |---|---|---|---| | `TextEncoder.mlpackage` | 6-bit | 88 MB | CLIP text encoding | | `Unet.mlpackage` | 8-bit | 821 MB | Latent diffusion (inpainting) | | `VAEEncoder.mlpackage` | 6-bit | 25 MB | Image -> latent | | `VAEDecoder.mlpackage` | 6-bit | 36 MB | Latent -> image | **Total:** 970 MB (well within iOS app size budgets) ## Usage (iOS, Swift) ```swift import CoreML let config = MLModelConfiguration() config.computeUnits = .all // ANE + GPU + CPU let textEncoder = try TextEncoder(configuration: config) let unet = try Unet(configuration: config) let vaeEncoder = try VAEEncoder(configuration: config) let vaeDecoder = try VAEDecoder(configuration: config) ``` For inference, see [apple/ml-stable-diffusion](https://github.com/apple/ml-stable-diffusion) — this package is drop-in compatible, with the UNet modified to accept a 9-channel input (4 latent + 4 masked image latent + 1 mask) per the inpainting convention. ## Files - `Resources/` — the four `.mlpackage` submodels - `tokenizer/` — CLIP tokenizer (vocab.json + merges.txt) - `scheduler_config.json` — LCM scheduler config - `manifest.json` — per-submodel quantization metadata ## Source - Original PyTorch model: [SimianLuo/LCM_Dreamshaper_v7](https://huggingface.co/SimianLuo/LCM_Dreamshaper_v7) - Base: runwayml/stable-diffusion-v1-5 - Conversion script: [convert_sd_inpaint_apple.py](https://github.com/byteReactr/SHxTLxST/scripts/convert_sd_inpaint_apple.py) - Conversion pipeline: trace on Linux+GPU -> convert on macOS (coremltools `BlobWriter` is macOS-only) ## License Original SD 1.5: CreativeML Open RAIL-M. The CoreML conversion is a derivative work; this repo inherits the Open RAIL-M license.