加载中…
加载中…
OpenMOSS-Team/MOSS-Image-SFTA LoRA for MOSS-Image-SFT that makes pictures with an alpha channel. It draws cut-out subjects, logos, lettering and effects on a transparent background, and the sampler outputs RGBA PNGs directly, with no background-removal step. It is used together with trmz's RGBA FLUX.2 VAE (trmz/flux2-klein-alpha), which decodes four channels.
Seed-a outputs over a checker, from the evaluation below. Top row: an anime character, a photo of a fox, a glass of sparkling water, smoke. Bottom row: a tea-shop logo from a JSON layout prompt, brush calligraphy, a roll cake, neon lettering. RGBA originals: examples/*.png.
| File | |
|---|---|
transparent-lora-for-moss-image-v1.safetensors |
The LoRA. Rank 32 on every block's q, k, v, o, ffn_up_gate and ffn_down; 504 tensors, fp16, 149 MB. Keys are as ai-toolkit saves them (diffusion_model.layers.N.proj.<name>.lora_A.weight / lora_B.weight), with no alpha tensors (scale 1). |
inference_example.py |
A minimal, self-contained example of the recipe below. |
examples/ |
The showcase and three RGBA outputs. |
LICENSE, NOTICE |
Apache-2.0 and the attributions. |
It needs MOSS-Image-SFT (f972bd4), lodestones' 8-step distillation MOSS-Image-SFT-8-steps-dmd (f95df83), and the vae/ of trmz/flux2-klein-alpha (390379b). The LoRA was evaluated with this recipe:
isolated on a transparent background to the prompt. For a JSON layout prompt, append it to the summary caption.pip install "torch>=2.9" "diffusers>=0.38" "transformers>=5.3" safetensors huggingface_hub pillow
python inference_example.py "photo of a red fox sitting, with a big fluffy tail" fox.png --seed 21
python inference_example.py "photo of glowing blue neon tube lettering with the Japanese text 「ラーメン」" neon.png --seed 15 --width 1344 --height 768
The example runs the text encoder first and frees it before the transformer loads, so one 20 GB card is enough. On an RTX A6000 the example reproduces the production runtime's picture byte for byte (the fox above, seed 21). Our production runtime takes 14.9–16.1 s per 1024×1024 picture on an RTX 3080 20GB (text encoder streamed from host memory) and about 10.5 s on an RTX A6000.
Prompts and seeds of the showcase: fennec girl (seed 11, 832×1216), fox (21), sparkling water (3, 832×1216), smoke (4), tea-shop logo (9, a JSON layout with the text 「茶房 みどり」), kanji 「心」 (6), roll cake (12), neon 「ラーメン」 (15, 1344×768).
Data: 209 RGBA pictures that MOSS-Image itself drew with the recipe above minus this LoRA (bf16 SFT plus the 8-step distillation), on a plain background, then cut out:
| Kind | How the alpha was made |
|---|---|
| Subjects, logos, cards and stickers, drawn on flat mid-gray | trmz's Extract-4B LoRA on FLUX.2-klein-base-4B (both Apache-2.0), with a fitted background plate |
| Glowing effects and neon, drawn on black | Brightness: alpha is the brightest channel above the black level |
| Ink, drawn on white paper | Darkness against the paper, scaled so the darkest ink is opaque |
Every cut-out was checked by eye. The data has no other source: no third-party or scraped images, and no outputs of other image models. Captions are plain English and end with the trigger.
Recipe: ai-toolkit with trmz's RGBA patch. Rank 32 / alpha 32, AdamW 8-bit, constant learning rate 3e-4, batch 1, 2000 steps, resolutions 512, 768 and 1024, bf16. This release is the step-1750 save; the final save had started to lose its subjects.
12 held-out prompts × 2 seeds through the production runtime, each result checked over a checker and over dark green:
| Lost the subject (almost all transparent) | 0 / 24 |
| Kept a background (almost nothing transparent) | 0 / 24 |
| Fully opaque share of the non-transparent pixels | 0.39 |
The lettering in the evaluation (「心」, 「茶房 みどり」, 「ケーキセット 680円」) came out right at both seeds.
Apache-2.0. Everything that went into this LoRA is Apache-2.0 or MIT; see NOTICE. "MOSS-Image" names the model this LoRA is for and does not imply endorsement by its authors.
MOSS-Image-SFT 用の LoRA です。背景が透明な画像(アルファ付き PNG)を、背景除去の工程なしにサンプラーから直接作れます。被写体の切り抜き、ロゴ、文字、エフェクトに使えます。デコードには trmz の RGBA VAE(trmz/flux2-klein-alpha の vae/)を使います。
isolated on a transparent background を付けます(JSON レイアウトなら summary の caption に付けます)。inference_example.py のとおりです。20GB の GPU 1 枚で動きます。NOTICE を参照)。