Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: sana
|
3 |
+
tags:
|
4 |
+
- text-to-image
|
5 |
+
- SANA-1.5
|
6 |
+
- 1024px_based_image_size
|
7 |
+
- BF16
|
8 |
+
- diffusers
|
9 |
+
language:
|
10 |
+
- en
|
11 |
+
- zh
|
12 |
+
base_model:
|
13 |
+
- Efficient-Large-Model/SANA1.5_4800M_1024px_diffusers
|
14 |
+
pipeline_tag: text-to-image
|
15 |
+
---
|
16 |
+
<p align="center" style="border-radius: 10px">
|
17 |
+
<img src="https://raw.githubusercontent.com/NVlabs/Sana/refs/heads/main/asset/logo.png" width="35%" alt="logo"/>
|
18 |
+
</p>
|
19 |
+
|
20 |
+
<div style="display:flex;justify-content: center">
|
21 |
+
<a href="https://huggingface.co/collections/Efficient-Large-Model/sana-15-67d6803867cb21c230b780e4"><img src="https://img.shields.io/static/v1?label=Demo&message=Huggingface&color=yellow"></a>  
|
22 |
+
<a href="https://github.com/NVlabs/Sana"><img src="https://img.shields.io/static/v1?label=Code&message=Github&color=blue&logo=github"></a>  
|
23 |
+
<a href="https://nvlabs.github.io/Sana/Sana-1.5/"><img src="https://img.shields.io/static/v1?label=Project&message=Github&color=blue&logo=github-pages"></a>  
|
24 |
+
<!-- <a href="https://hanlab.mit.edu/projects/sana/"><img src="https://img.shields.io/static/v1?label=Page&message=MIT&color=darkred&logo=github-pages"></a>   -->
|
25 |
+
<a href="https://arxiv.org/abs/2501.18427"><img src="https://img.shields.io/static/v1?label=Arxiv&message=Sana&color=red&logo=arxiv"></a>  
|
26 |
+
<a href="https://nv-sana.mit.edu/"><img src="https://img.shields.io/static/v1?label=Demo&message=MIT&color=yellow"></a>  
|
27 |
+
<a href="https://discord.gg/rde6eaE5Ta"><img src="https://img.shields.io/static/v1?label=Discuss&message=Discord&color=purple&logo=discord"></a>  
|
28 |
+
</div>
|
29 |
+
|
30 |
+
# 🐱 Sana Model Card
|
31 |
+
|
32 |
+
## Model
|
33 |
+
|
34 |
+
<p align="center" border-raduis="10px">
|
35 |
+
<img src="https://nvlabs.github.io/Sana/Sana-1.5/asset/content/pipeline.png" width="80%" alt="teaser_page1"/>
|
36 |
+
</p>
|
37 |
+
|
38 |
+
We introduce **SANA-1.5**,an efficient model with scaling of training-time and inference time techniques.
|
39 |
+
SANA-1.5 delivers: **efficient model growth** from 1.6B Sana-1.0 model to 4.8B, achieving similar or better performance than training from scratch and saving 60% training cost;
|
40 |
+
**efficient model depth pruning**, slimming any model size as you want;
|
41 |
+
powerful VLM selection based **inference scaling**, smaller model+inference scaling > larger model;
|
42 |
+
Top-notch GenEval & DPGBench results. Detailed results are shown in the below table.
|
43 |
+
|
44 |
+
<p align="center" border-raduis="10px">
|
45 |
+
<img src="https://nvlabs.github.io/Sana/Sana-1.5/asset/content/geneval_comparison.png" alt="model growth performance on GenEval" class="inserted-image"
|
46 |
+
style="max-width: 45%; height: auto; display: inline-block;">
|
47 |
+
<img src="https://nvlabs.github.io/Sana/Sana-1.5/asset/content/optimizer_loss_comparison_with_ema.png" alt="8-bit optimizer" class="inserted-image"
|
48 |
+
style="max-width: 45%; height: auto; display: inline-block;">
|
49 |
+
</p>
|
50 |
+
|
51 |
+
Source code is available at https://github.com/NVlabs/Sana.
|
52 |
+
|
53 |
+
### Model Description
|
54 |
+
|
55 |
+
- **Developed by:** NVIDIA, Sana
|
56 |
+
- **Model type:** Scalable Linear-Diffusion-Transformer-based text-to-image generative model
|
57 |
+
- **Model size:** 4.8B parameters
|
58 |
+
- **Model precision:** torch.bfloat16 (BF16)
|
59 |
+
- **Model resolution:** This model is developed to generate 1024px based images with multi-scale heigh and width.
|
60 |
+
- **License:** [NSCL v2-custom](./LICENSE.txt). Governing Terms: NVIDIA License. Additional Information: [Gemma Terms of Use | Google AI for Developers](https://ai.google.dev/gemma/terms) for Gemma-2-2B-IT, [Gemma Prohibited Use Policy | Google AI for Developers](https://ai.google.dev/gemma/prohibited_use_policy).
|
61 |
+
- **Model Description:** This is a model that can be used to generate and modify images based on text prompts.
|
62 |
+
It is a Linear Diffusion Transformer that uses one fixed, pretrained text encoders ([Gemma2-2B-IT](https://huggingface.co/google/gemma-2-2b-it))
|
63 |
+
and one 32x spatial-compressed latent feature encoder ([DC-AE](https://hanlab.mit.edu/projects/dc-ae)).
|
64 |
+
- **Resources for more information:** Check out our [GitHub Repository](https://github.com/NVlabs/Sana) and the [Sana report on arXiv](https://arxiv.org/abs/2410.10629).
|
65 |
+
|
66 |
+
### Model Sources
|
67 |
+
|
68 |
+
For research purposes, we recommend our `generative-models` Github repository (https://github.com/NVlabs/Sana),
|
69 |
+
which is more suitable for both training and inference and for which most advanced diffusion sampler like Flow-DPM-Solver is integrated.
|
70 |
+
[MIT Han-Lab](https://nv-sana.mit.edu/) provides free Sana inference.
|
71 |
+
- **Repository:** ttps://github.com/NVlabs/Sana
|
72 |
+
- **Demo:** https://nv-sana.mit.edu/
|
73 |
+
|
74 |
+
### 🧨 Diffusers
|
75 |
+
Under construction [PR](https://github.com/huggingface/diffusers/pull/11074)
|
76 |
+
|
77 |
+
```python
|
78 |
+
import torch
|
79 |
+
from diffusers import SanaPipeline
|
80 |
+
|
81 |
+
pipe = SanaPipeline.from_pretrained(
|
82 |
+
"Efficient-Large-Model/SANA1.5_4.8B_1024px_diffusers",
|
83 |
+
torch_dtype=torch.bfloat16,
|
84 |
+
)
|
85 |
+
pipe.to("cuda")
|
86 |
+
|
87 |
+
pipe.text_encoder.to(torch.bfloat16)
|
88 |
+
|
89 |
+
# pipe.enable_model_cpu_offload()
|
90 |
+
|
91 |
+
prompt = 'Self-portrait oil painting, a beautiful cyborg with golden hair, 8k'
|
92 |
+
image = pipe(
|
93 |
+
prompt=prompt,
|
94 |
+
height=1024,
|
95 |
+
width=1024,
|
96 |
+
guidance_scale=4.5,
|
97 |
+
num_inference_steps=20,
|
98 |
+
)[0]
|
99 |
+
|
100 |
+
image[0].save(f"sana1.5.png")
|
101 |
+
```
|
102 |
+
|
103 |
+
## Uses
|
104 |
+
|
105 |
+
### Direct Use
|
106 |
+
|
107 |
+
The model is intended for research purposes only. Possible research areas and tasks include
|
108 |
+
|
109 |
+
- Generation of artworks and use in design and other artistic processes.
|
110 |
+
- Applications in educational or creative tools.
|
111 |
+
- Research on generative models.
|
112 |
+
- Safe deployment of models which have the potential to generate harmful content.
|
113 |
+
|
114 |
+
- Probing and understanding the limitations and biases of generative models.
|
115 |
+
|
116 |
+
Excluded uses are described below.
|
117 |
+
|
118 |
+
### Out-of-Scope Use
|
119 |
+
|
120 |
+
The model was not trained to be factual or true representations of people or events, and therefore using the model to generate such content is out-of-scope for the abilities of this model.
|
121 |
+
|
122 |
+
## Limitations and Bias
|
123 |
+
|
124 |
+
### Limitations
|
125 |
+
|
126 |
+
|
127 |
+
- The model does not achieve perfect photorealism
|
128 |
+
- The model cannot render complex legible text
|
129 |
+
- fingers, .etc in general may not be generated properly.
|
130 |
+
- The autoencoding part of the model is lossy.
|
131 |
+
|
132 |
+
### Bias
|
133 |
+
While the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.
|