Text-to-Image
Diffusers
Safetensors
StableDiffusionPipeline
stable-diffusion
stable-diffusion-diffusers
Instructions to use CompVis/stable-diffusion-v1-4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use CompVis/stable-diffusion-v1-4 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-4", dtype=torch.bfloat16, device_map="cuda") prompt = "A high tech solarpunk utopia in the Amazon rainforest" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
Update README.md
Browse filesAdd missing imports, model_id and device to float16 sample code.
README.md
CHANGED
|
@@ -90,6 +90,11 @@ If you are limited by GPU memory and have less than 10GB of GPU RAM available, p
|
|
| 90 |
|
| 91 |
```py
|
| 92 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision="fp16", use_auth_token=True)
|
| 95 |
pipe = pipe.to(device)
|
|
|
|
| 90 |
|
| 91 |
```py
|
| 92 |
import torch
|
| 93 |
+
from torch import autocast
|
| 94 |
+
from diffusers import StableDiffusionPipeline
|
| 95 |
+
|
| 96 |
+
model_id = "CompVis/stable-diffusion-v1-4"
|
| 97 |
+
device = "cuda"
|
| 98 |
|
| 99 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision="fp16", use_auth_token=True)
|
| 100 |
pipe = pipe.to(device)
|