ZYI-Opus is a 282M-parameter text-conditioned Diffusion Transformer. The backbone was initialised randomly and trained with a rectified-flow objective, on a total budget of US$ 15 of Modal compute (GPU + CPU + RAM, every stage included).
The 20 fixed evaluation prompts: one image per prompt, seed 42, no cherry-picking
(CFG 5, Euler 50 steps).
| part | model | trained here? |
|---|---|---|
| VAE | mit-han-lab/dc-ae-f32c32-sana-1.1-diffusers (256² → 32×8×8 latent) |
no, frozen |
| text encoder | openai/clip-vit-large-patch14 (77 hidden states + pooled projection) |
no, frozen |
| backbone | ZYIDiT-medium: 16 blocks, width 1024, 16 heads, SwiGLU, QK-RMSNorm, adaLN-single, cross-attention to CLIP | yes, from random init |
Data: 889,296 image-caption pairs from 24 of the 47 data_512_2M shards of
jackyhate/text-to-image-2M (MIT):
Text-, document- and pixel-art-heavy captions were filtered out. Duplicates were removed by caption and by image hash. Images are centre-cropped to 256².
Objective: rectified flow, v-prediction (v = noise − x0), timesteps from a logit-normal(0, 1).
10% caption dropout enables CFG; 30% of captions are cut to their first sentence.
Optimisation:
torch.compile; EMA 0.9995;Hardware: 1× NVIDIA H100 80GB on Modal, 81 min of training, 11,688 optimizer steps (≈ 12.0 M images seen, ≈ 13.5 epochs).
Cost: ≈ US$ 13.06 (billed by Modal: $4.87 preprocessing, $7.92 training incl. benchmark/smoke test, $0.07 sampling, rest tests/publishing) in total. The per-stage cost log is in the GitHub repo.
import torch
from safetensors.torch import load_file
from diffusers import AutoencoderDC
import sys; sys.path.insert(0, "code") # model.py / sampler.py from the code/ folder of this repo
from model import ZYIDiT
from sampler import TextEncoder, sample, decode
cfg = {"dim": 1024, "depth": 16, "heads": 16}
model = ZYIDiT(**cfg).cuda().eval()
model.load_state_dict(load_file("zyi_opus_ema.safetensors"))
stats = load_file("latent_stats.safetensors")
m, s = stats["lat_mean"].cuda(), stats["lat_std"].cuda()
te = TextEncoder("openai/clip-vit-large-patch14")
vae = AutoencoderDC.from_pretrained("mit-han-lab/dc-ae-f32c32-sana-1.1-diffusers", torch_dtype=torch.bfloat16).cuda()
z = sample(model, te, ["a red apple on a wooden table"], m, s, steps=50, cfg=5.0, shift=1.0, seed=42)
img = decode(vae, z, m, s)[0] # uint8 HxWx3
Code: GitHub Zylun-AI/zyi-opus.
zyi_opus_ema.safetensors 1.1 GBlatent_stats.safetensors 0.4 kB