File size: 2,563 Bytes
b1e787a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4754254
8dd5072
4754254
 
b1e787a
 
 
 
 
 
 
4d684d1
 
 
 
b1e787a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4d684d1
 
 
 
b1e787a
 
 
 
 
 
 
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
---
base_model: stabilityai/stable-diffusion-3-medium
pipeline_tag: text-to-image
library_name: coreml
tags:
  - coreml
  - ios
  - iphone
  - ane
  - stable-diffusion-3
  - mobile-diffusion
---

# MobileDiffuser SD3 Medium Core ML Models

<p>
  <img src="assets/showcase-collage.png" alt="Actual MobileDiffuser SD3 Medium 4-step local generation samples">
</p>

This repository contains the Core ML model bundle used by MobileDiffuser for
on-device Stable Diffusion 3 Medium inference on iPhone.

## Contents

- `coremlsd3_2step/`: SD3 Medium two-step Core ML resources.
- `coremlsd3_4step/`: SD3 Medium four-step Core ML resources.
- `checkpoints/sd3-medium-2step.safetensors`: source two-step distilled
  checkpoint used to build the two-step Core ML bundle.
- `checkpoints/sd3-medium-4step.safetensors`: source four-step distilled
  checkpoint used to build the four-step Core ML bundle.

Each bundle is organized for MobileDiffuser's split MMDiT runtime:

- `TextEncoder.mlmodelc`
- `TextEncoder2.mlmodelc`
- `MultiModalDiffusionTransformerConditioning.mlmodelc`
- `MultiModalDiffusionTransformerStage*.mlmodelc`
- `VAEDecoder.mlmodelc`

The MMDiT model is split into multiple ANE-friendly stages to reduce live
activation pressure and avoid out-of-memory termination on iPhone 15 Pro class
devices. The app loads the selected resource directory and runs either the
two-step or four-step scheduler configuration.

## Usage With MobileDiffuser

Clone this repository next to the MobileDiffuser app repository, or copy the two
resource directories into the MobileDiffuser project root:

```bash
cp -R coremlsd3_2step /path/to/MobileDiffuser/
cp -R coremlsd3_4step /path/to/MobileDiffuser/
```

Then open `MobileDiffuser.xcodeproj`, make sure both folders are included in the
app target resources, configure your signing team, and deploy to device.

## Git LFS

The model weights are stored with Git LFS. After cloning, run:

```bash
git lfs install
git lfs pull
```

If the `.mlmodelc` directories contain small pointer files instead of real model
weights, LFS objects were not pulled successfully.

The `.safetensors` checkpoints are also stored through LFS. They are provided so
the Core ML bundles can be reproduced or re-converted with different splitting
or quantization settings.

## Notes

- These resources are intended for 512x512 generation.
- The runtime is optimized for `cpuAndNeuralEngine`.
- The source training checkpoint is not included here.
- Make sure your use of the original SD3 Medium weights complies with the
  upstream model license.