File size: 2,558 Bytes
4cc65ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: other
license_name: circlestone-noncommercial
license_link: LICENSE
library_name: mlx
pipeline_tag: text-to-image
tags:
  - mlx
  - apple-silicon
  - text-to-image
  - anime
  - cosmos-predict2
base_model:
  - circlestone-labs/Anima
---

# Anima-MLX — anime text-to-image for Apple Silicon (MLX)

Pure-[MLX](https://github.com/ml-explore/mlx) port of **[circlestone-labs/Anima](https://huggingface.co/circlestone-labs/Anima)**,
an anime/illustration text-to-image model. The denoiser is **NVIDIA Cosmos-Predict2-2B**
(`CosmosTransformer3DModel`); the text path is **Qwen3-0.6B → a 6-block `llm_adapter`**; the
decoder is the **Qwen-Image / Wan 16-channel 3D-causal VAE**.

> **Built on NVIDIA Cosmos.** The base denoiser is licensed under the NVIDIA Cosmos Open Model
> License. The Anima fine-tune weights are **Non-Commercial** (CircleStone Labs). This MLX port is
> redistributed under the same Non-Commercial terms — **personal / research use only, not for
> commercial use.** Port code: MIT.

## Parity

Every component is parity-locked against a PyTorch oracle, and the full pipeline against a torch
reference (injected noise + identical token ids):

| stage | metric |
|---|---|
| Cosmos DiT | fp32 max_abs 3.1e-5 · bf16/GPU cos 0.999995 |
| llm_adapter | fp32 max_abs 2.9e-5 · bf16/GPU cos 0.999995 |
| Qwen3-0.6B TE | fp32 max_abs 6.1e-4 · bf16/GPU cos 0.999998 |
| Wan/Qwen-Image VAE | fp32 max_abs 7.5e-6 · bf16/GPU cos 0.999954 |
| e2e (text path) | max_abs 2.3e-6 |
| e2e (DiT-in-loop + CFG, step 0) | cos 1.0000000 |
| transformer int8 g128 | per-pass cos 0.99991 |
| transformer int4 g64 | per-pass cos 0.99628 |

## Files

| file | dtype | resident |
|---|---|---|
| `transformer-bf16.safetensors` | bf16 | 3.91 GB |
| `transformer-int4.safetensors` | int4 (attn+ff, g64) | 1.38 GB |
| `llm_adapter-bf16.safetensors` | bf16 | ~0.24 GB |
| `text_encoder-bf16.safetensors` | bf16 | ~1.2 GB |
| `vae-bf16.safetensors` | bf16 | ~0.25 GB |

Measured peak unified memory @512²: ~14 GB (bf16) / ~6 GB (int4 transformer).

## Sampling

ComfyUI `ModelType.FLOW` — `CONST` prediction + `ModelSamplingDiscreteFlow(shift=3, multiplier=1)`:
`sigma(t) = 3t / (1 + 2t)`, **DiT timestep == sigma ∈ [0,1]**, Wan21 latent denorm before decode.
CFG 4–5. Tokenizers: Qwen2.5 (raw BPE, pad 151643) + T5-v1.1 SentencePiece (32128, trailing eos).

## Credits

- Anima — CircleStone Labs (Non-Commercial)
- Cosmos-Predict2 — NVIDIA (Cosmos Open Model License)
- Qwen3 — Alibaba · Wan VAE — Alibaba/Wan
- MLX port — xocialize