Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,64 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- SanaControlNetPipeline
|
| 4 |
+
pipeline_tag: text-to-image
|
| 5 |
+
license: mit
|
| 6 |
+
---
|
| 7 |
+
<p align="center" style="border-radius: 10px">
|
| 8 |
+
<img src="https://raw.githubusercontent.com/NVlabs/Sana/refs/heads/main/asset/logo.png" width="35%" alt="logo"/>
|
| 9 |
+
</p>
|
| 10 |
+
|
| 11 |
+
<div style="display:flex;justify-content: center">
|
| 12 |
+
<a href="https://huggingface.co/collections/Efficient-Large-Model/sana-673efba2a57ed99843f11f9e"><img src="https://img.shields.io/static/v1?label=Demo&message=Huggingface&color=yellow"></a>  
|
| 13 |
+
<a href="https://github.com/NVlabs/Sana"><img src="https://img.shields.io/static/v1?label=Code&message=Github&color=blue&logo=github"></a>  
|
| 14 |
+
<a href="https://nvlabs.github.io/Sana/"><img src="https://img.shields.io/static/v1?label=Project&message=Github&color=blue&logo=github-pages"></a>  
|
| 15 |
+
<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>  
|
| 16 |
+
<a href="https://arxiv.org/abs/2410.10629"><img src="https://img.shields.io/static/v1?label=Arxiv&message=Sana&color=red&logo=arxiv"></a>  
|
| 17 |
+
<a href="https://nv-sana.mit.edu/"><img src="https://img.shields.io/static/v1?label=Demo&message=MIT&color=yellow"></a>  
|
| 18 |
+
<a href="https://discord.gg/rde6eaE5Ta"><img src="https://img.shields.io/static/v1?label=Discuss&message=Discord&color=purple&logo=discord"></a>  
|
| 19 |
+
</div>
|
| 20 |
+
|
| 21 |
+
# Model card
|
| 22 |
+
|
| 23 |
+
We introduce **Sana**, a text-to-image framework that can efficiently generate images up to 4096 × 4096 resolution.
|
| 24 |
+
Sana can synthesize high-resolution, high-quality images with strong text-image alignment at a remarkably fast speed, deployable on laptop GPU.
|
| 25 |
+
|
| 26 |
+
Source code is available at https://github.com/NVlabs/Sana.
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
### 🧨 Diffusers
|
| 30 |
+
|
| 31 |
+
### 1. How to use `SanaControlNetPipeline` with `🧨diffusers`
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
# run `pip install git+https://github.com/huggingface/diffusers` before use Sana in diffusers
|
| 35 |
+
import torch
|
| 36 |
+
from diffusers import SanaControlNetModel, SanaControlNetPipeline
|
| 37 |
+
from diffusers.utils import load_image
|
| 38 |
+
|
| 39 |
+
controlnet = SanaControlNetModel.from_pretrained(
|
| 40 |
+
"ishan24/Sana_600M_1024px_ControlNet_diffusers",
|
| 41 |
+
torch_dtype=torch.float16
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
pipe = SanaControlNetPipeline.from_pretrained(
|
| 45 |
+
"Efficient-Large-Model/Sana_600M_1024px_diffusers",
|
| 46 |
+
variant="fp16",
|
| 47 |
+
controlnet=controlnet,
|
| 48 |
+
torch_dtype=torch.float16,
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
pipe.to('cuda')
|
| 52 |
+
pipe.vae.to(torch.bfloat16)
|
| 53 |
+
pipe.text_encoder.to(torch.bfloat16)
|
| 54 |
+
|
| 55 |
+
cond_image = load_image(
|
| 56 |
+
"https://huggingface.co/ishan24/Sana_600M_1024px_ControlNet_diffusers/resolve/main/hed_example.png"
|
| 57 |
+
)
|
| 58 |
+
prompt='a cat with a neon sign that says "Sana"'
|
| 59 |
+
image = pipe(
|
| 60 |
+
prompt,
|
| 61 |
+
control_image=cond_image,
|
| 62 |
+
).images[0]
|
| 63 |
+
image.save("sana.png")
|
| 64 |
+
```
|