Anima RGBA
Transparent (RGBA) image generation for Anima.
- RGBA VAE. A 4-channel version of the Qwen-Image VAE used by Anima. It decodes Anima latents into images with a real alpha channel instead of opaque RGB.
- RGBA LoRA. Trained on latents from this VAE, so Anima generates latents the VAE decodes with a clean alpha channel.
| File | Size | Notes |
|---|---|---|
vae/anima_rgba_vae.safetensors |
508 MB | full VAE (encoder + decoder), ComfyUI Qwen-Image VAE key format |
loras/anima_rgba_lora.safetensors |
184 MB | LoRA for the Anima DiT (step 25,000) |
Usage (ComfyUI)
No custom nodes needed. Take an existing Anima workflow and change three things:
- VAE. Put
anima_rgba_vae.safetensorsinmodels/vaeand select it inLoad VAEinstead of the Qwen-Image VAE. - LoRA. Put
anima_rgba_lora.safetensorsinmodels/lorasand add it with a normal LoRA loader (strength 1.0). - Trigger. Add
transparent background(orisolated on a transparent background) to the prompt.
If the background stays opaque, raise the trigger weight, e.g. (transparent background:1.3), rather than the
LoRA strength. A higher trigger weight leaves the image and alpha almost unchanged; LoRA strength 1.5 adds stray
semi-transparent debris around the subject.
VAE Decode then outputs a 4-channel image (straight RGB + alpha), and Save Image writes it as an RGBA PNG.
Without the LoRA the VAE still produces an alpha channel, but it is hazy. The base model's latents only roughly match what the VAE expects.
Examples
Anima base, LoRA 1.0, 30 steps, CFG 4.5, er_sde / simple, 1024 Γ 1024. Top: RGBA output over a checkerboard.
Bottom: alpha channel. The original RGBA PNGs are in examples/.
Prompts, each prefixed with masterpiece, best quality, newest, safe, :
| Image | Prompt | Seed |
|---|---|---|
knight.png |
1boy, solo, transparent background, armor, holding sword, cape, full body, fighting stance |
202 |
witch.png |
1girl, solo, transparent background, witch hat, holding staff, floating hair, magic, upper body |
202 |
angel.png |
1girl, solo, transparent background, angel wings, halo, white dress, looking at viewer, cowboy shot |
101 |
cake.png |
no humans, transparent background, food, strawberry shortcake, fruit, still life |
101 |
Negative: worst quality, low quality, score_1, score_2, score_3, blurry, jpeg artifacts
RGBA VAE
How it works
| Original Qwen-Image VAE | Anima RGBA VAE | |
|---|---|---|
| Encoder input | RGB | RGB composited over white, then alpha (4 ch) |
| Latent | 16 ch, 1/8 | 16 ch, 1/8 (same space, small drift) |
| Decoder output | RGB | straight (un-premultiplied) RGB + alpha (4 ch) |
- Initialisation. The 3-channel weights are copied. The new alpha input column starts at zero. The new alpha output row starts at zero with bias +1, so before training the model behaves exactly like the original VAE and decodes everything as opaque.
- Why composite over white. RGB is undefined where alpha = 0. A white composite gives those pixels a defined colour, and it is what Anima already draws for "transparent background" prompts. The RGBA latents therefore stay close to latents the base model already produces.
- Reference loss. During training the new encoder is pulled towards the frozen original encoder's latents for the same white composite. This keeps the latent space where Anima works, so the LoRA only has to learn the small alpha residual.
Comparison with the original VAE
Holdout set at 512 px: 200 transparent images and 50 opaque images. None of them were used in training.
Transparent images (the original VAE cannot represent these, so there is no baseline)
| Metric | Value |
|---|---|
| Alpha MAE | 0.0027 (β 0.7 / 255) |
| Alpha RMSE | 0.0157 (β 4 / 255; error concentrates on edges) |
| PSNR, composited over white | 34.94 dB |
| PSNR, composited over black | 33.17 dB |
Opaque images (RGB reconstruction, same images through both VAEs)
| PSNR | |
|---|---|
| Original Qwen-Image VAE | 34.26 dB |
| Anima RGBA VAE | 34.74 dB (+0.48) |
Latent drift. The RMS distance between the new and original encoder means, in units of the latent std, is 0.058. The new latents are about 6 % of a standard deviation away from the original ones. This is the gap the LoRA has to bridge when generating RGBA latents.
Training
| Base | Qwen-Image VAE (split_files/vae/qwen_image_vae.safetensors from Anima) |
| Steps | 12,000 at batch 4, 512 px random crops |
| LR | encoder 1e-5, decoder 5e-5, 500 warmup steps |
| Losses | L1 of composites over random solid backgrounds (1.0), LPIPS (0.2), alpha L1 (1.0), alpha Sobel-gradient L1 (0.5), reference latent MSE vs. original encoder (0.1) |
| Opaque share | 15 % of each batch |
Data
| Train | Holdout | |
|---|---|---|
| Transparent images (RGBA) | 16,496 | 449 |
| Opaque images (regularisation) | 3,032 | 167 |
- Transparent images have at least 5 % fully transparent and 3 % opaque pixels.
- Images with a drawn checkerboard instead of real transparency are excluded.
- Near-duplicates are removed by RGB and alpha dHash.
RGBA LoRA
Dataset
| Subset | Images | Repeats | Content |
|---|---|---|---|
semi |
4,754 | 3 | transparent images with semi-transparent areas (> 2 % of pixels with 16 < alpha < 240) |
normal |
11,742 | 1 | other transparent images |
reg |
1,930 | 1 | opaque single-character images |
| Total | 18,426 | 27,934 samples per epoch |
- Images are downscaled to a maximum side of 1536 and trained with aspect-ratio buckets: 1024 base resolution, 512β1536, steps of 64.
- Latents are cached with the RGBA VAE.
Captions
Tags in this order:
rating, count, character, copyright, @artist, trigger, general tags
- Ratings:
safe/sensitiveonly. - At most 40 general tags. Dropped:
simple_background,white_background,transparent_background,highres,absurdres,lowres, commentary and id-related tags,official_art. - Transparent images have two caption lines, one per trigger. A random line is used each step:
transparent backgroundisolated on a transparent background
- Opaque
regimages have no trigger.
Training
| Trainer | sd-scripts anima_train_network, networks.lora_anima |
| Trained modules | DiT only (Qwen3 text encoder and LLM adapter frozen) |
| Rank / alpha | 32 / 32 |
| Optimizer | AdamW8bit, LR 5e-5, constant with 100 warmup steps |
| Batch | 2, bf16, gradient checkpointing |
| Timesteps | sigmoid sampling, discrete flow shift 1.0 |
| Steps | 25,000 (14,363 steps per epoch) |
Test results
8 prompts Γ 2 seeds at 1024 Γ 1024, decoded with the RGBA VAE. The same prompts and seeds were used for every row.
- Transparent: at least 5 % of pixels with alpha < 0.5.
- Semi-transparent pixels: share of pixels with 0.06 < alpha < 0.94 (mean over the 16 images). Lower means a cleaner cut-out; real semi-transparent areas count here too.
Setups:
- A: Anima base, 30 steps, CFG 4.5.
- B: Anima fine-tune + turbo LoRA (0.8) + style LoRA, 12 steps, CFG 1.
| LoRA strength | Trigger weight | A: transparent | A: semi-transparent | B: transparent | B: semi-transparent |
|---|---|---|---|---|---|
| no LoRA | 1.0 | 16 / 16 | 12.8 % | 16 / 16 | 21.1 % |
| 1.0 | 1.0 | 16 / 16 | 0.9 % | 16 / 16 | 3.5 % |
| 1.2 | 1.0 | 16 / 16 | 1.0 % | 16 / 16 | 3.2 % |
| 1.5 | 1.0 | 16 / 16 | 1.4 % | 16 / 16 | 6.0 % |
| 1.0 | 1.2 | 16 / 16 | 0.9 % | 16 / 16 | 3.1 % |
| 1.0 | 1.5 | 16 / 16 | 0.9 % | 16 / 16 | 3.1 % |
- Without the LoRA the VAE still separates a background, but the alpha is hazy: characters and white clothing come out partly transparent.
- Raising the trigger weight keeps the composition and the alpha almost unchanged.
- Raising the LoRA strength changes the image. At 1.5 it adds stray semi-transparent debris and smoke around the subject.
Limitations
- The VAE was trained on 512 px crops. It decodes at higher resolutions, but very fine semi-transparent detail (hair strands, glass, smoke) is the weakest area.
- Generated alpha is mostly binary. See-through clothing usually comes out opaque.
- Close-ups that fill the frame sometimes keep an opaque white background, more often with other LoRAs stacked.
- Built for anime/illustration content (Anima).
License
The VAE is derived from the Qwen-Image VAE (Apache-2.0).
Model tree for localai0301/Anima-RGBA
Base model
nvidia/Cosmos-Predict2-2B-Text2Image