aqualaguna's picture
Add benchmarks
77ebf61 verified
|
Raw History Blame Contribute Delete
4.09 kB
---
license: other
license_name: see-upstream
base_model:
- OpenMOSS-Team/MOSS-Image-SFT
- chinoll/Moss-Image-Edit
pipeline_tag: image-to-image
language:
- en
- zh
tags:
- moss-image
- openvino
- intel
- intel-arc
- image-editing
- int8
- experimental
---
# MOSS-Image-Edit for OpenVINO (Intel Arc GPUs), experimental
[OpenMOSS-Team/MOSS-Image-SFT](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT) with the community edit LoRA
[chinoll/Moss-Image-Edit](https://huggingface.co/chinoll/Moss-Image-Edit) (rank 64, project
[Chenkin-x/Moss-Image-Edit](https://github.com/Chenkin-x/Moss-Image-Edit)) **merged into the weights** and converted to
OpenVINO IR. Tested on an Intel Arc Pro B60 24 GB with OpenVINO 2026.4. Staged and tested, never put into production.
**Licences:** base model Apache-2.0; the edit project's code is GPLv3; the LoRA repo states no weight licence. These
merged weights inherit whatever terms apply upstream: check both before using them. Not affiliated with either project.
## Needs the text-to-image repo
Only the edit DiT is here. The text encoder, VAE decoder and tokenizer are identical to
[aqualaguna/MOSS-Image-SFT-OpenVINO](https://huggingface.co/aqualaguna/MOSS-Image-SFT-OpenVINO) (`te/`, `vae/`, `tokenizer/`).
| folder | content | size |
|---|---|---|
| `dit_edit_fp16/` | `text_refine`, `edit_a`, `edit_b`, `edit_c` (fp16), `vae_encoder_f32`, host weights | 9.8 GB |
| `dit_edit_int8/` | same, NNCF per-channel INT8_ASYM, `ffn_down` kept fp16 | 6.4 GB |
| `code/` | pipeline + server with both text-to-image and edit samplers (`edit_ops.py`, `edit_export.py`) | <1 MB |
The reference image enters as timestep-0 prefix tokens whose K/V are computed once per request.
## What works
- **Box-JSON layout edits localise:** 88–99.5 % of the pixel change lands inside the given box; outside the box ~30 dB PSNR to the input.
- **Text is only correct when the exact words are written in the prompt.** Asked for e.g. an "infographic" without the text,
it draws plausible-looking but garbled lettering.
- One reference image (the LoRA accepts up to 3; more were not measured). Capped at 1024Γ—1024.
## Speed and memory (Arc Pro B60, 1024Β², 30 steps, guidance 4)
| | time | peak GPU memory |
|---|---|---|
| fp16 | ~105 s | 21.6 GB |
| int8 | ~95 s | 17.6 GB |
**Benchmark** (2026-11-02, 12 edits fp16 + 6 int8 over 5 scenes: living room, kitchen, park, street, cafe, anime; box-JSON and plain-text prompts;
1024Β², 30 steps, guidance 4, 4096 reference tokens, all outputs finite):
| | total per edit | s/step | DiT load | text encoder | ref prefill | VAE | peak GPU (`peak_gpu_usm_device_mb`) |
|---|---|---|---|---|---|---|---|
| fp16 | 103.5–106.6 s | 2.96–3.02 | 6.1–6.9 s | 5.7–6.4 s | 1.4–1.7 s | 0.4–0.9 s | 20.9k (short text prompt) – 21.6k (box JSON) |
| int8 keepdown | 92.7–95.6 s | 2.80–2.84 | 6.4–7.3 s | cached* | 1.4–1.5 s | 0.4 s | 17.6k |
\* the int8 runs reused the prompt embeddings from the fp16 runs; add ~6 s for a new prompt.
The edit DiT is unloaded after each call: OV scratch memory grows per distinct token count (reached 27.8 GB without that).
The fp16 residual is scaled by 1/8 inside the graph to avoid fp16 overflow.
## Use
Same requirements as the text-to-image repo. Put the folders as `models/{te,tokenizer,vae,dit_sft_edit,dit_sft_edit_int8_keepdown}`
(rename `dit_edit_fp16` β†’ `dit_sft_edit`, `dit_edit_int8` β†’ `dit_sft_edit_int8_keepdown`).
```python
import sys; sys.path.insert(0, "code")
import numpy as np
from moss_pipeline import MossImage
from PIL import Image
pipe = MossImage(models_dir="models", device="GPU", cache_dir="ov_cache", variant="edit-int8")
src = np.asarray(Image.open("in.png").convert("RGB").resize((1024, 1024)))
img, stats = pipe.generate_edit([src], "replace the sky with a sunset", width=1024, height=1024, steps=30, guidance=4.0, seed=1)
Image.fromarray(img).save("out.png")
```
`code/server.py` serves it over HTTP (`"model": "edit"` or `"edit-int8"` with an `image` field). Paths like
`/opt/mossimage/...` are from the original box; adjust them.