(🔥 New) [2025/10/27] 📺SANA-Video is released. [README] | [Weights] support Text-to-Video, TextImage-to-Video.
(🔥 New) [2025/10/13] 📺SANA-Video is coming, 1). a 5s Linear DiT Video model, and 2). real-time minute-length video generation (with LongLive). [paper] | [Page]
(🔥 New) [2025/3/14] 🏃SANA-Sprint is coming out! 🎉 A new one/few-step generator of Sana. 0.1s per 1024px image on H100, 0.3s on RTX 4090. Find out more details: [Page] | [Arxiv]. Code is coming very soon along with diffusers
(🔥 New) [2025/1/24] DCAE-1.1 is released, better reconstruction quality. [Model][diffusers]
(🔥 New) [2025/1/23] Sana is accepted as Oral by ICLR-2025. 🎉🎉🎉
(🔥 New) [2025/1/12] DC-AE tiling makes Sana-4K inferences 4096x4096px images within 22GB GPU memory. With model offload and 8bit/4bit quantize. The 4K Sana run within 8GB GPU VRAM. [Guidance]
(🔥 New) [2025/1/11] Sana code-base license changed to Apache 2.0.
(🔥 New) [2025/1/10] Inference Sana with 8bit quantization.[Guidance]
(🔥 New) [2025/1/8] 1.6B 4K resolution Sana models are released: [BF16 pth] or [BF16 diffusers]. 🚀 Get your 4096x4096 resolution images within 20 seconds! Find more samples in Sana page. Thanks SUPIR for their wonderful work and support.
(🔥 New) [2025/1/2] Bug in the diffusers pipeline is solved. Solved PR
✅ [2024/12] 1.6B 2K resolution Sana models are released: [BF16 pth] or [BF16 diffusers]. 🚀 Get your 2K resolution images within 4 seconds! Find more samples in Sana page. Thanks SUPIR for their wonderful work and support.
✅ [2024/12] diffusers supports Sana-LoRA fine-tuning! Sana-LoRA's training and convergence speed is super fast. [Guidance] or [diffusers docs].
✅ [2024/12] diffusers has Sana! All Sana models in diffusers safetensors are released and diffusers pipeline SanaPipeline, SanaPAGPipeline, DPMSolverMultistepScheduler(with FlowMatching) are all supported now. We prepare a Model Card for you to choose.
✅ [2024/12] 1.6B BF16 Sana model is released for stable fine-tuning.
We introduce Sana, a text-to-image framework that can efficiently generate images up to 4096 × 4096 resolution.
Sana can synthesize high-resolution, high-quality images with strong text-image alignment at a remarkably fast speed, deployable on laptop GPU.
Core designs include:
(1) DC-AE: unlike traditional AEs, which compress images only 8×, we trained an AE that can compress images 32×, effectively reducing the number of latent tokens.
(2) Linear DiT: we replace all vanilla attention in DiT with linear attention, which is more efficient at high resolutions without sacrificing quality.
(3) Decoder-only text encoder: we replaced T5 with a modern decoder-only small LLM as the text encoder and designed complex human instruction with in-context learning to enhance the image-text alignment.
(4) Efficient training and sampling: we propose Flow-DPM-Solver to reduce sampling steps, with efficient caption labeling and selection to accelerate convergence.
As a result, Sana-0.6B is very competitive with modern giant diffusion models (e.g. Flux-12B), being 20 times smaller and 100+ times faster in measured throughput. Moreover, Sana-0.6B can be deployed on a 16GB laptop GPU, taking less than 1 second to generate a 1024 × 1024 resolution image. Sana enables content creation at low cost.
1git clone https://github.com/NVlabs/Sana.git
2cd Sana
34./environment_setup.sh sana
5# or you can install each components step by step following environment_setup.sh
💻 2. How to Play with Sana (Inference)
💰Hardware requirement
9GB VRAM is required for 0.6B model and 12GB VRAM for 1.6B model. Our later quantization version will require less than 8GB for inference.
All the tests are done on A100 GPUs. Different GPU version may be different.
Make sure to specify pipe.transformer to default torch_dtype and variant according to Model Card.
Set pipe.text_encoder to BF16 and pipe.vae to FP32 or BF16. For more info, docs are here.
python
1# run `pip install git+https://github.com/huggingface/diffusers` before use Sana in diffusers2import torch
3from diffusers import SanaPipeline
45pipe = SanaPipeline.from_pretrained(6"Efficient-Large-Model/SANA1.5_1.6B_1024px_diffusers",7 torch_dtype=torch.bfloat16,8)9pipe.to("cuda")1011pipe.vae.to(torch.bfloat16)12pipe.text_encoder.to(torch.bfloat16)1314prompt ='a cyberpunk cat with a neon sign that says "Sana"'15image = pipe(16 prompt=prompt,17 height=1024,18 width=1024,19 guidance_scale=4.5,20 num_inference_steps=20,21 generator=torch.Generator(device="cuda").manual_seed(42),22)[0]2324image[0].save("sana.png")
2. How to use SanaPAGPipeline with 🧨diffusers
Click to show all
python
1# run `pip install git+https://github.com/huggingface/diffusers` before use Sana in diffusers2import torch
3from diffusers import SanaPAGPipeline
45pipe = SanaPAGPipeline.from_pretrained(6"Efficient-Large-Model/SANA1.5_1.6B_1024px_diffusers",7 torch_dtype=torch.bfloat16,8 pag_applied_layers="transformer_blocks.8",9)10pipe.to("cuda")1112pipe.text_encoder.to(torch.bfloat16)13pipe.vae.to(torch.bfloat16)1415prompt ='a cyberpunk cat with a neon sign that says "Sana"'16image = pipe(17 prompt=prompt,18 guidance_scale=5.0,19 pag_scale=2.0,20 num_inference_steps=20,21 generator=torch.Generator(device="cuda").manual_seed(42),22)[0]23image[0].save('sana.png')
# Pull related models
huggingface-cli download google/gemma-2b-it
huggingface-cli download google/shieldgemma-2b
huggingface-cli download mit-han-lab/dc-ae-f32c32-sana-1.1
huggingface-cli download Efficient-Large-Model/Sana_1600M_1024px
# Run with docker
docker build . -t sana
docker run --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 \
-v ~/.cache:/root/.cache \
sana
5. Run inference with TXT or JSON files
bash
1# Run samples in a txt file2python scripts/inference.py \3 --config=configs/sana_config/1024ms/Sana_1600M_img1024.yaml \4 --model_path=hf://Efficient-Large-Model/Sana_1600M_1024px/checkpoints/Sana_1600M_1024px.pth \5 --txt_file=asset/samples/samples_mini.txt
67# Run samples in a json file8python scripts/inference.py \9 --config=configs/sana_config/1024ms/Sana_1600M_img1024.yaml \10 --model_path=hf://Efficient-Large-Model/Sana_1600M_1024px/checkpoints/Sana_1600M_1024px.pth \11 --json_file=asset/samples/samples_mini.json
1# Example of training Sana 0.6B with 512x512 resolution from scratch2bash train_scripts/train.sh \3 configs/sana_config/512ms/Sana_600M_img512.yaml \4 --data.data_dir="[asset/example_data]"\5 --data.type=SanaImgDataset \6 --model.multi_scale=false \7 --train.train_batch_size=3289# Example of fine-tuning Sana 1.6B with 1024x1024 resolution10bash train_scripts/train.sh \11 configs/sana_config/1024ms/Sana_1600M_img1024.yaml \12 --data.data_dir="[asset/example_data]"\13 --data.type=SanaImgDataset \14 --model.load_from=hf://Efficient-Large-Model/Sana_1600M_1024px/checkpoints/Sana_1600M_1024px.pth \15 --model.multi_scale=false \16 --train.train_batch_size=8
2). Train with Multi-Scale WebDataset
We also provide conversion scripts to convert your data to the required format. You can refer to the data conversion scripts for more details.
1# Example of training Sana 0.6B with 512x512 resolution from scratch2bash train_scripts/train.sh \3 configs/sana_config/512ms/Sana_600M_img512.yaml \4 --data.data_dir="[asset/example_data_tar]"\5 --data.type=SanaWebDatasetMS \6 --model.multi_scale=true \7 --train.train_batch_size=32
3). Train with TAR file
We prepared a toy TAR dataset containing 100 random images from Journey-DB, duplicated for testing purposes. Note that this dataset is not intended for training.
1# DDP2# Example of training Sana 1.6B with 512x512 resolution from scratch3bash train_scripts/train.sh \4 configs/sana1-5_config/1024ms/Sana_1600M_1024px_allqknorm_bf16_lr2e5.yaml \5 --data.data_dir="[data/toy_data]"\6 --data.type=SanaWebDatasetMS \7 --model.multi_scale=true \8 --data.load_vae_feat=true \9 --train.train_batch_size=2
bash
1# FSDP2# Example of training Sana 1.6B with 512x512 resolution from scratch3bash train_scripts/train.sh \4 configs/sana1-5_config/1024ms/Sana_1600M_1024px_AdamW_fsdp.yaml \5 --data.data_dir="[data/toy_data]"\6 --data.type=SanaWebDatasetMS \7 --model.multi_scale=true \8 --data.load_vae_feat=true \9 --train.use_fsdp=true \10 --train.train_batch_size=2
We trained a specialized NVILA-2B model to score images, which we named VISA (VIla as SAna verifier). By selecting the top 4 images from 2,048 candidates, we enhanced the GenEval performance of SD1.5 and SANA-1.5-4.8B v2, increasing their scores from 42 to 87 and 81 to 96, respectively.
Details refer to Inference Scaling Manual.
| Method | Overall | Single | Two | Counting | Colors | Position | Color Attribution |
Method
Overall
Single
Two
Counting
Colors
Position
Color Attribution
SD1.5
0.42
0.98
0.39
0.31
0.72
0.04
0.06
+ Inference Scaling
0.87
1.00
0.97
0.93
0.96
0.75
0.62
SANA-1.5 4.8B v2
0.81
0.99
0.86
0.86
0.84
0.59
0.65
+ Inference Scaling
0.96
1.00
1.00
0.97
0.94
0.96
0.87
SD1.5
0.42
0.98
0.39
0.31
0.72
0.04
0.06
+ Inference Scaling
0.87
1.00
0.97
0.93
0.96
0.75
0.62
SANA-1.5 4.8B v2
0.81
0.99
0.86
0.86
0.84
0.59
0.65
+ Inference Scaling
0.96
1.00
1.00
0.97
0.94
0.96
0.87
🏃 6. SANA-Sprint
Our SANA-Sprint models focus on timestep distillation, achieving high-quality generation with 1-4 inference steps. Refer to SANA-Sprint Manual for more details.
SANA-Video is a small diffusion model designed for efficient video generation, capable of synthesizing high-resolution videos (up to $720 \times 1280$) and minute-length duration with strong text-video alignment, while maintaining a remarkably fast speed.It enables low-cost, high-quality video generation and can be deployed efficiently on consumer GPUs like the RTX 5090.
Refer to SANA-Video Manual for more details.
@misc{xie2024sana,
title={Sana: Efficient High-Resolution Image Synthesis with Linear Diffusion Transformer},
author={Enze Xie and Junsong Chen and Junyu Chen and Han Cai and Haotian Tang and Yujun Lin and Zhekai Zhang and Muyang Li and Ligeng Zhu and Yao Lu and Song Han},
year={2024},
eprint={2410.10629},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2410.10629},
}
@misc{xie2025sana,
title={SANA 1.5: Efficient Scaling of Training-Time and Inference-Time Compute in Linear Diffusion Transformer},
author={Xie, Enze and Chen, Junsong and Zhao, Yuyang and Yu, Jincheng and Zhu, Ligeng and Lin, Yujun and Zhang, Zhekai and Li, Muyang and Chen, Junyu and Cai, Han and others},
year={2025},
eprint={2501.18427},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2501.18427},
}
@misc{chen2025sanasprint,
title={SANA-Sprint: One-Step Diffusion with Continuous-Time Consistency Distillation},
author={Junsong Chen and Shuchen Xue and Yuyang Zhao and Jincheng Yu and Sayak Paul and Junyu Chen and Han Cai and Song Han and Enze Xie},
year={2025},
eprint={2503.09641},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2503.09641},
}
@misc{chen2025sana,
title={SANA-Video: Efficient Video Generation with Block Linear Diffusion Transformer},
author={Chen, Junsong and Zhao, Yuyang and Yu, Jincheng and Chu, Ruihang and Chen, Junyu and Yang, Shuai and Wang, Xianbang and Pan, Yicheng and Zhou, Daquan and Ling, Huan and others},
year={2025},
eprint={2509.24695},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2509.24695},
}