File size: 10,490 Bytes
760bd1f
 
 
c970403
 
 
760bd1f
 
be06992
 
 
760bd1f
 
 
 
 
 
a553403
760bd1f
a553403
b6e579d
 
a553403
760bd1f
4a27e85
a553403
4a27e85
 
 
 
a553403
 
4a27e85
 
 
 
42e7422
 
be06992
a553403
 
 
 
be06992
 
a553403
 
be06992
 
 
 
 
a553403
be06992
 
 
13c9933
760bd1f
be06992
 
 
13c9933
be06992
 
 
 
 
760bd1f
 
95bf78b
8858ec2
760bd1f
 
 
 
95bf78b
 
8858ec2
95bf78b
c970403
95bf78b
 
 
760bd1f
8858ec2
95bf78b
 
760bd1f
c970403
760bd1f
 
be06992
 
 
 
 
8858ec2
be06992
 
963b20b
be06992
 
 
963b20b
be06992
 
 
 
13c9933
be06992
 
 
 
 
13c9933
be06992
 
 
 
 
 
 
40da894
 
 
 
 
 
 
 
 
 
 
8158957
 
 
 
 
 
 
 
 
40da894
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
be06992
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
---
library_name: diffusers
pipeline_tag: image-to-image
base_model:
  - neonforestmist/Clover-Image-Tiny
  - stable-diffusion-v1-5/stable-diffusion-inpainting
license: creativeml-openrail-m
tags:
  - image-editing
  - local-ai
  - diffusers
  - clover-image
  - inpainting
  - stable-diffusion
  - coreml
---

<h1 align="center">Clover Image Tiny Inpaint HQ</h1>

<p align="center">
  <strong>SD 1.5-class inpainting for local, prompt-guided image edits.</strong><br>
  Image + mask + prompt · Clover's shared components · Diffusers and separate Core ML resources.
</p>

<table align="center" width="100%">
<tr>
<td align="center" width="25%"><a href="https://huggingface.co/neonforestmist/Clover-Image-Tiny"><img src="https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint/resolve/main/assets/links/model.svg" alt="HF MODEL" width="100%"></a></td>
<td align="center" width="25%"><a href="https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint"><img src="https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint/resolve/main/assets/links/inpaint.svg" alt="INPAINTING" width="100%"></a></td>
<td align="center" width="25%"><a href="https://huggingface.co/spaces/neonforestmist/Clover-Image-Tiny-Demo"><img src="https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint/resolve/main/assets/links/live-demo.svg" alt="LIVE DEMO" width="100%"></a></td>
<td align="center" width="25%"><a href="https://github.com/neonforestmist/Clover-Image-Tiny-iOS"><img src="https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint/resolve/main/assets/links/ios-app.svg" alt="IPHONE / CORE ML" width="100%"></a></td>
</tr>
<tr>
<td align="center" width="25%"><a href="https://github.com/neonforestmist/clover-image-tiny-lora-trainer"><img src="https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint/resolve/main/assets/links/trainer.svg" alt="LORA TRAINER" width="100%"></a></td>
<td align="center" width="25%"><a href="https://github.com/neonforestmist/Clover-Image-Tiny"><img src="https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint/resolve/main/assets/links/source.svg" alt="GITHUB SOURCE" width="100%"></a></td>
<td align="center" width="25%"><a href="https://github.com/neonforestmist/Clover-Image-Tiny/actions/workflows/quality.yml"><img src="https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint/resolve/main/assets/links/checks.svg" alt="QUALITY CHECKS" width="100%"></a></td>
<td align="center" width="25%"><a href="https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint/blob/main/LICENSE"><img src="https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint/resolve/main/assets/links/license.svg" alt="MODEL LICENSE" width="100%"></a></td>
</tr>
</table>

<p align="center"><a href="#inpainting-example">Example</a> · <a href="#model">Model</a> · <a href="#run-an-edit-with-python">Run it</a> · <a href="https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint/blob/main/docs/MODEL_DETAILS.md">Evaluation &amp; documentation</a></p>

---

## Inpainting example

The white area of a mask selects what to regenerate; black selects what to preserve.
This published example uses the prompt **“add blue sunglasses.”**

| Original image | Masked edit |
|:---:|:---:|
| ![Cat artwork before the sunglasses edit](https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint/resolve/3e22009fb6e61944f28b0389f775fc47e2c48724/examples/sunglasses-source.png) | ![Clover inpainting result showing blue sunglasses on the cat](https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint/resolve/3e22009fb6e61944f28b0389f775fc47e2c48724/examples/sunglasses-result.png) |

## Model

Inpaint HQ uses the **full Stable Diffusion 1.5 inpainting denoiser** with Clover's
text encoder, tokenizer, VAE, and scheduler. It is a larger model than the compact
regular Clover text-to-image checkpoint. Regular Clover generates from text; Inpaint HQ requires an image and mask.

On the release's 24-edit held-out evaluation, HQ improved masked prompt alignment by
**4.8%** and reduced masked target error by **11.1%** versus the previous Clover inpainting
release. These are evaluation-set results; individual edits still depend on the image,
mask, and prompt. [See the quality gate and selection record below](#evaluation-and-provenance).

## Run an edit with Python

Install the [project's pinned Python dependencies](https://github.com/neonforestmist/Clover-Image-Tiny#run-clover-locally).
This example uses an NVIDIA CUDA GPU:

```python
import torch
from diffusers import AutoPipelineForInpainting, DPMSolverMultistepScheduler
from diffusers.utils import load_image

pipe = AutoPipelineForInpainting.from_pretrained(
    "neonforestmist/Clover-Image-Tiny-Inpaint",
    torch_dtype=torch.float16,
).to("cuda")
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)

image = pipe(
    prompt="a glossy red enamel kettle resting naturally on the countertop",
    negative_prompt="blurry, distorted, low detail",
    image=load_image("source.png"),
    mask_image=load_image("mask.png"),
    num_inference_steps=20,
    guidance_scale=6.0,
    padding_mask_crop=96,
).images[0]
image.save("clover-inpaint.png")
```

Start with **20 steps**, **guidance 6.0**, and **96 pixels of surrounding context**.
Use a source image and same-size grayscale mask. Small selections benefit from a
context crop so the model can see both the edited region and its surroundings.
To use an already downloaded model offline, pass `local_files_only=True` to
`from_pretrained`.

<details>
<summary>Apple silicon and CPU</summary>

For Apple silicon, change `.to("cuda")` to `.to("mps")`. For CPU, use
`torch_dtype=torch.float32` and `.to("cpu")`; generation is slower. Hardware,
precision, and dependencies can change the result even with the same seed.

</details>

## Styles and Apple devices

The Clover iOS app linked above provides a native masking workflow.
Core ML resources are published [separately](https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint-CoreML).

Published Clover attention-only LoRAs are mechanically compatible in Diffusers,
but they were trained for text-to-image, so evaluate each style's editing quality.
The shipping iOS inpainting screen does not enable dynamic styles.
Adapter and deployment details are included in Evaluation and provenance below.

## Limits and license

Small text, hands, faces, exact logos, and very small masks can be difficult.
Review generated edits before sharing. The model inherits the limitations and
**CreativeML Open RAIL-M** obligations of Clover and Stable Diffusion 1.5 inpainting.

## Evaluation and provenance

<details>
<summary>Quality gate, selection record, Core ML, and LoRA compatibility</summary>

## Quality gate

The release was evaluated on 24 deterministic, held-out, human-rated
InpaintCOCO edits. Every output was also reviewed in three visual contact
sheets before release.

| Metric | Previous Clover inpaint | HQ release | Change vs. previous Clover | SD 1.5 inpaint teacher |
|---|---:|---:|---:|---:|
| Masked prompt CLIP similarity ↑ | 0.2642 | **0.2768** | **4.8% higher** | 0.2820 |
| Masked target MAE ↓ | 0.2510 | **0.2231** | **11.1% lower error** | 0.2156 |
| Changed pixels outside the mask ↓ | 0 | 0 | Unchanged | 0 |

**↑ Higher is better; ↓ lower is better. Bold highlights HQ's improvements over the previous Clover release, not the best score across all models.**
The strongest measured improvement is **11.1% lower masked target error**.
The SD 1.5 teacher still scores better on both alignment and target error in this evaluation.

The HQ release improves prompt alignment by 4.8% and reduces masked target
error by 11.1% relative to the previous Clover inpainting release. The visual
gate showed recognizable buses, dogs, trains, furniture, signs, and
scene-consistent lighting where the compact candidates often collapsed into
amorphous fills.

## Selection provenance

The release process compared the existing checkpoint, a 30,000-step full-U-Net
distillation run, two fused context-LoRA refinements, partial weight blends,
the full Stable Diffusion inpainting reference, and this Clover-component
hybrid. The 30,000-step and context-LoRA candidates were rejected because they
did not beat the existing release across both visual and quantitative gates.
The published HQ architecture was the only Clover-compatible candidate that
materially improved both prompt alignment and reconstruction.

- Inpainting U-Net revision:
  `stable-diffusion-v1-5/stable-diffusion-inpainting@8a4288a76071f7280aedbdb3253bdb9e9d5d84bb`
- Clover components: `neonforestmist/Clover-Image-Tiny`
- Evaluation dataset: `phiyodr/InpaintCOCO@1ffac84be2dfc5ad9afccad868522fad64457435`
- Selection platform: Modal H100
- Evaluation seed: `20260813`

## Core ML and style mixing

The companion iOS resources are published at
[`neonforestmist/Clover-Image-Tiny-Inpaint-CoreML`](https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint-CoreML).

In Diffusers, the published Clover style LoRAs are mechanically compatible
with this nine-channel U-Net because they modify attention projections only;
those tensor shapes are unchanged from the four-channel model. They were
trained for text-to-image, however, so masked-edit quality should be evaluated
per style. LoRAs that modify the four-channel input convolution are not
compatible.

Dynamic Core ML loading is a separate deployment capability. The shipping iOS
inpainting screen currently selects a stateless or chunked U-Net and does not
enable styles. An adapter-aware stateful nine-channel export can provide up to
three independently weighted slots, but it must include the matching adapter
schema and be validated on its target devices. For a stateless deployment,
fuse a compatible LoRA before conversion.

## Limitations

Small text, hands, faces, exact logos, and masks below latent resolution can
still fail. Output quality depends on the source, mask, prompt, scheduler,
guidance, seed, and step count. This release inherits the limitations and
license obligations of Clover Image Tiny and Stable Diffusion 1.5 inpainting.

</details>

## Citation

```bibtex
@software{lozadaperez2026cloverimagetinyinpaint,
  author = {Lukas Lozada Perez},
  title = {Clover Image Tiny Inpaint HQ: Local Context-Aware Image Inpainting},
  year = {2026},
  url = {https://huggingface.co/neonforestmist/Clover-Image-Tiny-Inpaint}
}
```

Created by **Lukas Lozada Perez**.