Instructions to use CompVis/stable-diffusion-v1-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use CompVis/stable-diffusion-v1-2 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-2", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Commit ·
19fc41b
1
Parent(s): 6cf1aef
Update README.md
Browse files
README.md
CHANGED
|
@@ -66,12 +66,12 @@ model_id = "CompVis/stable-diffusion-v1-2"
|
|
| 66 |
device = "cuda"
|
| 67 |
|
| 68 |
|
| 69 |
-
pipe = StableDiffusionPipeline.from_pretrained(model_id
|
| 70 |
pipe = pipe.to(device)
|
| 71 |
|
| 72 |
prompt = "a photo of an astronaut riding a horse on mars"
|
| 73 |
with autocast("cuda"):
|
| 74 |
-
image = pipe(prompt
|
| 75 |
|
| 76 |
image.save("astronaut_rides_horse.png")
|
| 77 |
```
|
|
|
|
| 66 |
device = "cuda"
|
| 67 |
|
| 68 |
|
| 69 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id)
|
| 70 |
pipe = pipe.to(device)
|
| 71 |
|
| 72 |
prompt = "a photo of an astronaut riding a horse on mars"
|
| 73 |
with autocast("cuda"):
|
| 74 |
+
image = pipe(prompt)["sample"][0]
|
| 75 |
|
| 76 |
image.save("astronaut_rides_horse.png")
|
| 77 |
```
|