Spaces:
Running on Zero
Running on Zero
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,13 +1,63 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 6.32.0
|
| 8 |
-
python_version:
|
| 9 |
app_file: app.py
|
|
|
|
|
|
|
| 10 |
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: MOSS-Image 4-Step Distill LoRA
|
| 3 |
+
emoji: ⚡
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 6.32.0
|
| 8 |
+
python_version: "3.12"
|
| 9 |
app_file: app.py
|
| 10 |
+
short_description: MOSS-Image-SFT in 4 sampling steps via distillation LoRA
|
| 11 |
+
startup_duration_timeout: 1h
|
| 12 |
pinned: false
|
| 13 |
+
license: apache-2.0
|
| 14 |
+
models:
|
| 15 |
+
- OpenMOSS-Team/MOSS-Image-SFT
|
| 16 |
+
- lvladikov/MOSS-SFT-Distill-4step-LoRA
|
| 17 |
---
|
| 18 |
|
| 19 |
+
# ⚡ MOSS-Image 4-Step Distillation LoRA
|
| 20 |
+
|
| 21 |
+
Text-to-image with [MOSS-Image-SFT](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT) — OpenMOSS's ~5B DiT model —
|
| 22 |
+
distilled from its 50-step CFG-3 teacher down to **4 sampling steps at CFG 1** by
|
| 23 |
+
[lvladikov/MOSS-SFT-Distill-4step-LoRA](https://huggingface.co/lvladikov/MOSS-SFT-Distill-4step-LoRA).
|
| 24 |
+
|
| 25 |
+
Four transformer calls per picture, no negative prompt — roughly a second of GPU time
|
| 26 |
+
instead of the ~18 s the 50-step teacher needs. The LoRA is applied unmerged beside the
|
| 27 |
+
bf16 weights via forward hooks, exactly as its model card prescribes (the custom MOSS
|
| 28 |
+
pipeline has no `load_lora_weights`, and merging by bf16 rounding would erase most of
|
| 29 |
+
the update).
|
| 30 |
+
|
| 31 |
+
## Recipe
|
| 32 |
+
|
| 33 |
+
Locked to the LoRA card's recommendation:
|
| 34 |
+
|
| 35 |
+
| Setting | Value |
|
| 36 |
+
|---|---|
|
| 37 |
+
| Sampling steps | **4** (the distill's home; 6 and 8 also trained) |
|
| 38 |
+
| Guidance scale | **1.0** (CFG-off: one model call per step, no negative prompt) |
|
| 39 |
+
| LoRA strength | **1.0** (lower drifts back toward the base, higher doubles edges) |
|
| 40 |
+
| Schedule | MOSS's own shift-5 Euler (σ = 1.0 → 0.910 → 0.717 → 0.024) |
|
| 41 |
+
| Sizes | the 12 trained resolutions (all multiples of 16) |
|
| 42 |
+
|
| 43 |
+
Prompts are full rendered captions, not keyword bags — MOSS-Image was trained on
|
| 44 |
+
captions.
|
| 45 |
+
|
| 46 |
+
## Running it
|
| 47 |
+
|
| 48 |
+
Runs on ZeroGPU via `@spaces.GPU(duration=60)` per call. Example prompts in the
|
| 49 |
+
demo are copied verbatim from the LoRA's model card widget examples.
|
| 50 |
+
|
| 51 |
+
## API
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
from gradio_client import Client
|
| 55 |
+
|
| 56 |
+
client = Client("hugging-apps/moss-image-4step-lora")
|
| 57 |
+
image, info = client.predict(
|
| 58 |
+
prompt="A snow leopard walking along a rocky ridge in falling snow, telephoto wildlife photograph, natural light",
|
| 59 |
+
resolution="1024 × 1024",
|
| 60 |
+
seed=0,
|
| 61 |
+
api_name="/generate",
|
| 62 |
+
)
|
| 63 |
+
```
|