Instructions to use simota1987/Sana_Sprint with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Sana
How to use simota1987/Sana_Sprint with Sana:
# Load the model and infer image from text import torch from app.sana_pipeline import SanaPipeline from torchvision.utils import save_image sana = SanaPipeline("configs/sana_config/1024ms/Sana_1600M_img1024.yaml") sana.from_pretrained("hf://simota1987/Sana_Sprint") image = sana( prompt='a cyberpunk cat with a neon sign that says "Sana"', height=1024, width=1024, guidance_scale=5.0, pag_guidance_scale=2.0, num_inference_steps=18, ) - Notebooks
- Google Colab
- Kaggle
SANA-Sprint 0.6B for Local Dream (MNN)
1024ร1024 in 1โ2 steps, running entirely on-device through MNN (CPU + OpenCL). No NPU required, so this also works on non-Snapdragon devices.
Measured on a Snapdragon 8 Gen 3 (SM8650), 1024px / 2 steps:
| stage | backend | time |
|---|---|---|
| text encoder (Gemma-2-2B) | CPU | ~31 s cold, ~0 s once the prompt is cached |
| DiT ร2 steps | OpenCL fp16 | ~1.7 s each |
| DC-AE decode | OpenCL, 4ร640px tiles | ~19 s |
โ 29 s with the prompt cached, โ 60 s for a brand-new prompt.
Layout
SANA marker file: tells Local Dream this is a SANA model dir
dit.mnn (+ .weight) SANA-Sprint DiT, fp16
vae_decoder.mnn DC-AE decoder, full 1024px (CPU path)
vae_decoder_tile.mnn DC-AE decoder, 640px tile (GPU path; optional)
gemma/
tokenizer.json
token_emb.bin [256000, 2304] fp16 embedding table, looked up on CPU
gemma_meta.json
gemma_chunk0..3.mnn (+ .weight) the 26 layers, split four ways
Place the whole directory under Local Dream's models folder; it appears as a custom model.
Licensing
- The DiT and DC-AE are converted from Efficient-Large-Model/Sana_Sprint_0.6B_1024px_diffusers, which is Apache-2.0.
gemma/is Gemma-2-2B-IT, governed by the Gemma Terms of Use and the Gemma Prohibited Use Policy. Those terms apply to this copy as well โ this part is not Apache-2.0.
Notes on the conversion
Three things are easy to get wrong and are baked into these files:
- The text encoder runs over 506 tokens, not 300. SANA prepends a fixed
208-token instruction, runs Gemma over
208 + 300 โ 2positions, and only then selects[0] + last 299. - The encoder is split into four chunks on purpose. Each boundary acts as an fp32 checkpoint; merged into fewer, longer graphs, MNN's fp16 error compounds badly โ the same 13 layers differ by 44% as one graph vs two.
- The DiT's linear attention is rewritten for fp16:
valueis scaled (notquery, which would drag the attention denominator under the clamp) and the denominator is clamped at the smallest fp16 normal. Both are exactly neutral in fp32; without them some prompts decode to a fully black image.
- Downloads last month
- -