Skip to content

Commit afefb6b

Browse files
authored
Add diffusers integration
1 parent 4e409af commit afefb6b

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

doc/UNCLIP.MD

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,25 @@ To use them, download from Hugging Face, and put and the weights into the `check
1515
#### Image Variations
1616
![image-variations-l-1](../assets/stable-samples/stable-unclip/unclip-variations.png)
1717

18-
Run
18+
Diffusers integration
19+
Stable UnCLIP Image Variations is integrated with the [🧨 diffusers](https://github.com/huggingface/diffusers) library
20+
```python
21+
#pip install git+https://github.com/huggingface/diffusers.git transformers accelerate
22+
import torch
23+
from diffusers import StableUnCLIPPipeline
24+
25+
pipe = StableUnCLIPPipeline.from_pretrained(
26+
"stabilityai/stable-diffusion-2-1-unclip", torch_dtype=torch.float16
27+
)
28+
pipe = pipe.to("cuda")
29+
30+
prompt = "a photo of an astronaut riding a horse on mars"
31+
images = pipe(prompt).images
32+
images[0].save("astronaut_horse.png")
33+
```
34+
Check out the [Stable UnCLIP pipeline docs here](https://huggingface.co/docs/diffusers/api/pipelines/stable_unclip)
35+
36+
Streamlit UI demo
1937

2038
```
2139
streamlit run scripts/streamlit/stableunclip.py

0 commit comments

Comments
 (0)