Add Core ML inpainting model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Clover Image Tiny Inpaint — Core ML
|
| 2 |
+
|
| 3 |
+
This export is the iPhone 15 target for the 9-channel Clover Image Tiny
|
| 4 |
+
inpainting U-Net. The conversion is pinned to the Apple Stable Diffusion
|
| 5 |
+
converter vendored under `.coreml-converter` and targets iOS 18.
|
| 6 |
+
|
| 7 |
+
## Resource contract
|
| 8 |
+
|
| 9 |
+
The app-managed `Resources` directory contains:
|
| 10 |
+
|
| 11 |
+
```text
|
| 12 |
+
TextEncoder.mlmodelc
|
| 13 |
+
VAEEncoder.mlmodelc
|
| 14 |
+
VAEDecoder.mlmodelc
|
| 15 |
+
SafetyChecker.mlmodelc
|
| 16 |
+
UnetChunk1.mlmodelc
|
| 17 |
+
UnetChunk2.mlmodelc
|
| 18 |
+
vocab.json
|
| 19 |
+
merges.txt
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
The U-Net input is `[1, 9, 64, 64]`, ordered as noisy latent, mask, and
|
| 23 |
+
masked-image latent. The VAE encoder is required to create the final four
|
| 24 |
+
channels on device. White mask pixels are regenerated and black pixels are
|
| 25 |
+
preserved.
|
| 26 |
+
|
| 27 |
+
## Convert and validate
|
| 28 |
+
|
| 29 |
+
```bash
|
| 30 |
+
coreml-tools/convert_inpaint.sh coreml-inpaint artifacts/clover-image-tiny-inpaint
|
| 31 |
+
coreml-tools/smoke-test-inpaint.sh artifacts/clover-image-tiny-inpaint coreml-inpaint
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
The validator checks the 9-channel Diffusers configuration, required compiled
|
| 35 |
+
resources, the fixed Core ML input shape, finite output, and random-input
|
| 36 |
+
PyTorch/Core ML parity. The all-accelerators path is used because the macOS
|
| 37 |
+
CPU-only Core ML runtime can return NaNs for this MLProgram even though the
|
| 38 |
+
Neural Engine-capable path is valid.
|
| 39 |
+
|
| 40 |
+
The resulting `Resources` directory can be published as the companion model
|
| 41 |
+
repo [`neonforestmist/Clover-Image-Tiny-Inpaint-CoreML`](https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint-CoreML).
|