Downloads · 30 days
0
xiwenyoumu/LinearVSR-SFT-22113408
LinearVSR-SFT-22113408 is a machine learning model from xiwenyoumu. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
<p align="center" style="border-radius: 10px" <img src="asset/logo.png" width="35%" alt="logo"/ </p
Downloads · 30 days
0
Access
Public
Updated Jul 3, 2026
Repo size
17.9 GB
Likes
0
Public
Click a slice to open those files.
.pth17.9 GB · 100%
From the Hugging Face model README
Demo: SANA-1.5 | SANA-ControlNet | SANA-4bit | SANA-Sprint | SANA-Sprint (HF) | SANA-Video<br> ComfyUI: ComfyUI Guidance <br> Model Zoo: Model Card Collects All Models <br> Env Preparation: One-Click Env Install <br> Blog: Infinite Context for LLM and Video Generation <br> Inference: <br> 1) diffusers:SanaPipeline <br> 2) diffusers:SanaPAGPipeline <br> 3) Ours:SanaPipeline <br> 4) Inference with Docker <br> 5) Inference with TXT or JSON Files <br> 6) Inference SANA-Video <br> 6) Inference LongSANA <br> Training and Data: <br> 1) Image-Text Pairs <br> 2) Multi-Scale Webdataset <br> 3) TAR File Multi-Scale Webdataset <br> 4) FSDP Launch <br> 5) LoRA Training <br> 6) SANA-Sprint Diffusers Training <br> 7) SANA-Video Training <br> 8) LongSANA Training <br>
2K & 4K Resolution Generation: SANA is Capable to Generate 2K & 4K Images (Only 8BG) <br> ControlNet: Train&Inference Guidance | Model Zoo | Demo <br> Dreambooth / LoRA Training: Train&Inference Guidance <br> Quantization: Inference with 8bit | Inference with 4bit (8BG) | 4bit Model | 4bit Demo | 4bit Demo2 <br> 8bit Optimizer: How to Config <br> Inference Scaling: SANA Generate VILA Pick Inference Scaling <br> Metrics: Metric Toolkit: (FID, CLIP-Score, GenEval, DPG-Bench) <br>
SANA-Sprint: One-Step Diffusion: Arxiv | Train&Inference Guidance | Model Zoo | HF Weights <br> SANA-1.5: Efficient Model Scaling: Arxiv | Model Zoo | HF Weights <br> SANA-Video: Efficient Video Gen: Arxiv | Train&Inference Guidance | Model Zoo | HF Weights <br> LongSANA: SANA-Video + LongLive: Train&Inference Guidance | Model Zoo | HF Weights <br>
Mission: TODO
diffusersdiffusers pipeline is solved. Solved PRdiffusers supports Sana-LoRA fine-tuning! Sana-LoRA's training and convergence speed is super fast. [Guidance] or [diffusers docs].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.diffusers.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.
<p align="center" border-raduis="10px"> <img src="asset/model-incremental.jpg" width="90%" alt="teaser_page2"/> </p>| Methods (1024x1024) | Throughput (samples/s) | Latency (s) | Params (B) | Speedup | FID 👇 | CLIP 👆 | GenEval 👆 | DPG 👆 |
| Methods (1024x1024) | Throughput (samples/s) | Latency (s) | Params (B) | Speedup | FID 👇 | CLIP 👆 | GenEval 👆 | DPG 👆 |
|---|---|---|---|---|---|---|---|---|
| FLUX-dev | 0.04 | 23.0 | 12.0 | 1.0× | 10.15 | 27.47 | 0.67 | 84.0 |
| Sana-0.6B | 1.7 | 0.9 | 0.6 | 39.5× | 5.81 | 28.36 | 0.64 | 83.6 |
| Sana-0.6B | 1.7 | 0.9 | 0.6 | 39.5× | 5.61 | 28.80 | 0.68 | 84.2 |
| Sana-1.6B | 1.0 | 1.2 | 1.6 | 23.3× | 5.92 | 28.94 | 0.69 | <u>84.5</u> |
| Sana-1.5 1.6B | 1.0 | 1.2 | 1.6 | 23.3× | <u>5.70</u> | <u>29.12</u> | 0.82 | <u>84.5</u> |
| Sana-1.5 4.8B | 0.26 | 4.2 | 4.8 | 6.5× | 5.99 | 29.23 | <u>0.81</u> | 84.7 |
| FLUX-dev | 0.04 | 23.0 | 12.0 | 1.0× | 10.15 | 27.47 | 0.67 | 84.0 |
| Sana-0.6B | 1.7 | 0.9 | 0.6 | 39.5× | 5.81 | 28.36 | 0.64 | 83.6 |
| Sana-0.6B | 1.7 | 0.9 | 0.6 | 39.5× | 5.61 | 28.80 | 0.68 | 84.2 |
| Sana-1.6B | 1.0 | 1.2 | 1.6 | 23.3× | 5.92 | 28.94 | 0.69 | <u>84.5</u> |
| Sana-1.5 1.6B | 1.0 | 1.2 | 1.6 | 23.3× | <u>5.70</u> | <u>29.12</u> | 0.82 | <u>84.5</u> |
| Sana-1.5 4.8B | 0.26 | 4.2 | 4.8 | 6.5× | 5.99 | 29.23 | <u>0.81</u> | 84.7 |
| Methods | Throughput (samples/s) | Latency (s) | Params (B) | Speedup | FID 👆 | CLIP 👆 | GenEval 👆 | DPG 👆 |
| Methods | Throughput (samples/s) | Latency (s) | Params (B) | Speedup | FID 👆 | CLIP 👆 | GenEval 👆 | DPG 👆 |
|---|---|---|---|---|---|---|---|---|
| 512 × 512 resolution | ||||||||
| PixArt-α | 1.5 | 1.2 | 0.6 | 1.0× | 6.14 | 27.55 | 0.48 | 71.6 |
| PixArt-Σ | 1.5 | 1.2 | 0.6 | 1.0× | 6.34 | 27.62 | <u>0.52</u> | 79.5 |
| Sana-0.6B | 6.7 | 0.8 | 0.6 | 5.0× | <u>5.67</u> | <u>27.92</u> | 0.64 | <u>84.3</u> |
| Sana-1.6B | 3.8 | 0.6 | 1.6 | 2.5× | 5.16 | 28.19 | 0.66 | 85.5 |
| 1024 × 1024 resolution | ||||||||
| LUMINA-Next | 0.12 | 9.1 | 2.0 | 2.8× | 7.58 | 26.84 | 0.46 | 74.6 |
| SDXL | 0.15 | 6.5 | 2.6 | 3.5× | 6.63 | 29.03 | 0.55 | 74.7 |
| PlayGroundv2.5 | 0.21 | 5.3 | 2.6 | 4.9× | 6.09 | 29.13 | 0.56 | 75.5 |
| Hunyuan-DiT | 0.05 | 18.2 | 1.5 | 1.2× | 6.54 | 28.19 | 0.63 | 78.9 |
| PixArt-Σ | 0.4 | 2.7 | 0.6 | 9.3× | 6.15 | 28.26 | 0.54 | 80.5 |
| DALLE3 | - | - | - | - | - | - | 0.67 | 83.5 |
| SD3-medium | 0.28 | 4.4 | 2.0 | 6.5× | 11.92 | 27.83 | 0.62 | <u>84.1</u> |
| FLUX-dev | 0.04 | 23.0 | 12.0 | 1.0× | 10.15 | 27.47 | 0.67 | 84.0 |
| FLUX-schnell | 0.5 | 2.1 | 12.0 | 11.6× | 7.94 | 28.14 | 0.71 | 84.8 |
| Sana-0.6B | 1.7 | 0.9 | 0.6 | 39.5× | <u>5.81</u> | 28.36 | 0.64 | 83.6 |
| Sana-1.6B | 1.0 | 1.2 | 1.6 | 23.3× | 5.76 | <u>28.67</u> | <u>0.66</u> | 84.8 |
| 512 × 512 resolution | ||||||||
| PixArt-α | 1.5 | 1.2 | 0.6 | 1.0× | 6.14 | 27.55 | 0.48 | 71.6 |
| PixArt-Σ | 1.5 | 1.2 | 0.6 | 1.0× | 6.34 | 27.62 | <u>0.52</u> | 79.5 |
| Sana-0.6B | 6.7 | 0.8 | 0.6 | 5.0× | <u>5.67</u> | <u>27.92</u> | 0.64 | <u>84.3</u> |
| Sana-1.6B | 3.8 | 0.6 | 1.6 | 2.5× | 5.16 | 28.19 | 0.66 | 85.5 |
| 1024 × 1024 resolution | ||||||||
| LUMINA-Next | 0.12 | 9.1 | 2.0 | 2.8× | 7.58 | 26.84 | 0.46 | 74.6 |
| SDXL | 0.15 | 6.5 | 2.6 | 3.5× | 6.63 | 29.03 | 0.55 | 74.7 |
| PlayGroundv2.5 | 0.21 | 5.3 | 2.6 | 4.9× | 6.09 | 29.13 | 0.56 | 75.5 |
| Hunyuan-DiT | 0.05 | 18.2 | 1.5 | 1.2× | 6.54 | 28.19 | 0.63 | 78.9 |
| PixArt-Σ | 0.4 | 2.7 | 0.6 | 9.3× | 6.15 | 28.26 | 0.54 | 80.5 |
| DALLE3 | - | - | - | - | - | - | 0.67 | 83.5 |
| SD3-medium | 0.28 | 4.4 | 2.0 | 6.5× | 11.92 | 27.83 | 0.62 | <u>84.1</u> |
| FLUX-dev | 0.04 | 23.0 | 12.0 | 1.0× | 10.15 | 27.47 | 0.67 | 84.0 |
| FLUX-schnell | 0.5 | 2.1 | 12.0 | 11.6× | 7.94 | 28.14 | 0.71 | 84.8 |
| Sana-0.6B | 1.7 | 0.9 | 0.6 | 39.5× | <u>5.81</u> | 28.36 | 0.64 | 83.6 |
| Sana-1.6B | 1.0 | 1.2 | 1.6 | 23.3× | 5.76 | <u>28.67</u> | <u>0.66</u> | 84.8 |
git clone https://github.com/NVlabs/Sana.git
cd Sana
./environment_setup.sh sana
# or you can install each components step by step following environment_setup.sh
# official online demo
DEMO_PORT=15432 \
python app/app_sana.py \
--share \
--config=configs/sana_config/1024ms/Sana_1600M_img1024.yaml \
--model_path=hf://Efficient-Large-Model/Sana_1600M_1024px_BF16/checkpoints/Sana_1600M_1024px_BF16.pth \
--image_size=1024
SanaPipeline with 🧨diffusers[!IMPORTANT] [!IMPORTANT] Upgrade your
diffusers>=0.32.0.devto make theSanaPipelineandSanaPAGPipelineavailable!pip install git+https://github.com/huggingface/diffusersMake sure to specify
pipe.transformerto defaulttorch_dtypeandvariantaccording to Model Card.Set
pipe.text_encoderto BF16 andpipe.vaeto FP32 or BF16. For more info, docs are here.
# run `pip install git+https://github.com/huggingface/diffusers` before use Sana in diffusers
import torch
from diffusers import SanaPipeline
pipe = SanaPipeline.from_pretrained(
"Efficient-Large-Model/SANA1.5_1.6B_1024px_diffusers",
torch_dtype=torch.bfloat16,
)
pipe.to("cuda")
pipe.vae.to(torch.bfloat16)
pipe.text_encoder.to(torch.bfloat16)
prompt = 'a cyberpunk cat with a neon sign that says "Sana"'
image = pipe(
prompt=prompt,
height=1024,
width=1024,
guidance_scale=4.5,
num_inference_steps=20,
generator=torch.Generator(device="cuda").manual_seed(42),
)[0]
image[0].save("sana.png")
SanaPAGPipeline with 🧨diffusers# run `pip install git+https://github.com/huggingface/diffusers` before use Sana in diffusers
import torch
from diffusers import SanaPAGPipeline
pipe = SanaPAGPipeline.from_pretrained(
"Efficient-Large-Model/SANA1.5_1.6B_1024px_diffusers",
torch_dtype=torch.bfloat16,
pag_applied_layers="transformer_blocks.8",
)
pipe.to("cuda")
pipe.text_encoder.to(torch.bfloat16)
pipe.vae.to(torch.bfloat16)
prompt = 'a cyberpunk cat with a neon sign that says "Sana"'
image = pipe(
prompt=prompt,
guidance_scale=5.0,
pag_scale=2.0,
num_inference_steps=20,
generator=torch.Generator(device="cuda").manual_seed(42),
)[0]
image[0].save('sana.png')
</details>
import torch
from app.sana_pipeline import SanaPipeline
from torchvision.utils import save_image
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
generator = torch.Generator(device=device).manual_seed(42)
sana = SanaPipeline("configs/sana1-5_config/1024ms/Sana_1600M_1024px_allqknorm_bf16_lr2e5.yaml")
sana.from_pretrained("hf://Efficient-Large-Model/SANA1.5_1.6B_1024px/checkpoints/SANA1.5_1.6B_1024px.pth")
prompt = 'a cyberpunk cat with a neon sign that says "Sana"'
image = sana(
prompt=prompt,
height=1024,
width=1024,
guidance_scale=4.5,
pag_guidance_scale=1.0,
num_inference_steps=20,
generator=generator,
)
save_image(image, 'output/sana.png', nrow=1, normalize=True, value_range=(-1, 1))
</details>
# 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
</details>
# Run samples in a txt file
python scripts/inference.py \
--config=configs/sana_config/1024ms/Sana_1600M_img1024.yaml \
--model_path=hf://Efficient-Large-Model/Sana_1600M_1024px/checkpoints/Sana_1600M_1024px.pth \
--txt_file=asset/samples/samples_mini.txt
# Run samples in a json file
python scripts/inference.py \
--config=configs/sana_config/1024ms/Sana_1600M_img1024.yaml \
--model_path=hf://Efficient-Large-Model/Sana_1600M_1024px/checkpoints/Sana_1600M_1024px.pth \
--json_file=asset/samples/samples_mini.json
where each line of asset/samples/samples_mini.txt contains a prompt to generate
We provide a training example here and you can also select your desired config file from config files dir based on your data structure.
To launch Sana training, you will first need to prepare data in the following formats. Here is an example for the data structure for reference.
asset/example_data
├── AAA.txt
├── AAA.png
├── BCC.txt
├── BCC.png
├── ......
├── CCC.txt
└── CCC.png
Then Sana's training can be launched via
# Example of training Sana 0.6B with 512x512 resolution from scratch
bash train_scripts/train.sh \
configs/sana_config/512ms/Sana_600M_img512.yaml \
--data.data_dir="[asset/example_data]" \
--data.type=SanaImgDataset \
--model.multi_scale=false \
--train.train_batch_size=32
# Example of fine-tuning Sana 1.6B with 1024x1024 resolution
bash train_scripts/train.sh \
configs/sana_config/1024ms/Sana_1600M_img1024.yaml \
--data.data_dir="[asset/example_data]" \
--data.type=SanaImgDataset \
--model.load_from=hf://Efficient-Large-Model/Sana_1600M_1024px/checkpoints/Sana_1600M_1024px.pth \
--model.multi_scale=false \
--train.train_batch_size=8
We also provide conversion scripts to convert your data to the required format. You can refer to the data conversion scripts for more details.
python tools/convert_ImgDataset_to_WebDatasetMS_format.py
Then Sana's training can be launched via
# Example of training Sana 0.6B with 512x512 resolution from scratch
bash train_scripts/train.sh \
configs/sana_config/512ms/Sana_600M_img512.yaml \
--data.data_dir="[asset/example_data_tar]" \
--data.type=SanaWebDatasetMS \
--model.multi_scale=true \
--train.train_batch_size=32
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.
huggingface-cli download Efficient-Large-Model/toy_data --repo-type dataset --local-dir ./data/toy_data --local-dir-use-symlinks False
Then, you are ready to run with FSDP or DDP:
# DDP
# Example of training Sana 1.6B with 512x512 resolution from scratch
bash train_scripts/train.sh \
configs/sana1-5_config/1024ms/Sana_1600M_1024px_allqknorm_bf16_lr2e5.yaml \
--data.data_dir="[data/toy_data]" \
--data.type=SanaWebDatasetMS \
--model.multi_scale=true \
--data.load_vae_feat=true \
--train.train_batch_size=2
# FSDP
# Example of training Sana 1.6B with 512x512 resolution from scratch
bash train_scripts/train.sh \
configs/sana1-5_config/1024ms/Sana_1600M_1024px_AdamW_fsdp.yaml \
--data.data_dir="[data/toy_data]" \
--data.type=SanaWebDatasetMS \
--model.multi_scale=true \
--data.load_vae_feat=true \
--train.use_fsdp=true \
--train.train_batch_size=2
Refer to Toolkit Manual.
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 |
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.
<div align="center"> <a href="https://www.youtube.com/watch?v=nI_Ohgf8eOU" target="_blank"> <img src="https://img.youtube.com/vi/nI_Ohgf8eOU/0.jpg" alt="Demo Video of SANA-Sprint" style="width: 60%; margin: 0 auto; display: block"> </a> </div>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.
<div align="center"> <a href="https://www.youtube.com/watch?v=ztdkfIMkdJ4" target="_blank"> <img src="https://img.youtube.com/vi/ztdkfIMkdJ4/0.jpg" alt="Demo Video of SANA-Sprint" style="width: 60%; margin: 0 auto; display: inline-block"> </a> </div>We will try our best to achieve
diffusers: https://github.com/huggingface/diffusers/pull/10234)Thanks to the following open-sourced codebase for their wonderful work and codebase!
Thanks Paper2Video for generating Jeason presenting SANA😊. Refer to Paper2Video for more details.
<div align="center"> <a href="https://showlab.github.io/Paper2Video/assets/huang/huang.mp4" target="_blank"> <img src="asset/paper2video.jpg" alt="Presenting Video of SANA" style="width: 60%; margin: 0 auto; display: block"> </a> </div>Thanks goes to these wonderful contributors:
<a href="https://github.com/NVlabs/Sana/graphs/contributors"> <img src="https://contrib.rocks/image?repo=NVlabs/Sana" /> </a>@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},
}