File size: 2,207 Bytes
dcf634d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: creativeml-openrail-m
tags:
  - stable-diffusion
  - stable-diffusion-v1-5
  - inpainting
  - npuforge
base_model:
  - stable-diffusion-v1-5/stable-diffusion-v1-5
  - stable-diffusion-v1-5/stable-diffusion-inpainting
---

# SD 1.5 inpainting difference (for npuforge)

One file, `sd15inp_diff_f16.safetensors`, that turns an ordinary 4-channel SD 1.5
checkpoint into a 9-channel inpainting model ("add difference"). It is used by
[npuforge](https://github.com/AbrahamPaulJ/npuforge) on Android to convert SD 1.5
checkpoints into inpainting models for Qualcomm NPUs.

## What it contains

For every UNet tensor (`model.diffusion_model.*`, 686 tensors, 859,535,364 values):

```
diff = sd-v1-5-inpainting − v1-5-pruned-emaonly      (computed in float32, stored as float16)
```

`input_blocks.0.0.weight` (`conv_in`) is 9 channels wide in the inpainting model and 4
in the base. Channels 0–3 hold `inpainting − base`; channels 4–8 hold the inpainting
model's own mask / masked-image weights. Applying it is therefore always:

```
inpaint_unet = zero_pad_input_channels(custom_unet) + diff
```

Text encoder and VAE are not included; the custom checkpoint keeps its own.

| | |
|---|---|
| File size | 1,719,165,856 bytes |
| SHA-256 | `9f08e2684fc2c6261e705e28ff437fd0fae569b1dcf62336afef5994beb6d487` |
| Largest float16 rounding error | 0.000394 (max \|diff\| 1.427) |
| Sources | `stable-diffusion-v1-5/stable-diffusion-inpainting` `sd-v1-5-inpainting.ckpt`; `stable-diffusion-v1-5/stable-diffusion-v1-5` `v1-5-pruned-emaonly.safetensors` |

## Scope of testing

Measured on one phone (Snapdragon 8 Elite) through npuforge's inpaint template:
DreamShaper 8 and AbsoluteReality 1.6525 with this difference applied produced
correct, cleanly blended inpaints on a five-prompt fixture, and float16 storage matched
float32 storage within ordinary build-to-build variation. Checkpoints far from base
SD 1.5 are untested.

## License

Derived from Stable Diffusion v1.5 and Stable Diffusion Inpainting and distributed
under the same CreativeML OpenRAIL-M license, including its use-based restrictions
(Attachment A of the license). You are responsible for how you use models produced with it.