patrickvonplaten commited on
Commit
674ee30
1 Parent(s): cdb8b4e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +14 -8
README.md CHANGED
@@ -60,24 +60,30 @@ Run this command to log in with your HF Hub token if you haven't before:
60
  huggingface-cli login
61
  ```
62
 
63
- Running the pipeline with the default PLMS scheduler:
 
64
  ```python
65
  import torch
66
  from torch import autocast
67
  from diffusers import StableDiffusionPipeline
68
 
69
- model_id = "CompVis/stable-diffusion-v1-3"
70
  device = "cuda"
71
 
72
- generator = torch.Generator(device=device).manual_seed(0)
73
  pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
74
  pipe = pipe.to(device)
 
75
 
76
- prompt = "a photograph of an astronaut riding a horse"
77
- with autocast("cuda"):
78
- image = pipe(prompt, generator=generator)["sample"][0] # image here is in PIL format
79
-
80
- image.save(f"astronaut_rides_horse.png")
 
 
 
 
81
  ```
82
 
83
  To swap out the noise scheduler, pass it to `from_pretrained`:
 
60
  huggingface-cli login
61
  ```
62
 
63
+ Running the pipeline with the default PNDM scheduler:
64
+
65
  ```python
66
  import torch
67
  from torch import autocast
68
  from diffusers import StableDiffusionPipeline
69
 
70
+ model_id = "CompVis/stable-diffusion-v1-1"
71
  device = "cuda"
72
 
73
+
74
  pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
75
  pipe = pipe.to(device)
76
+ ```
77
 
78
+ **Note**:
79
+ If you are limited by GPU memory and have less than 10GB of GPU RAM available, please make sure to load the StableDiffusionPipeline in float16 precision instead of the default float32 precision as done above. You can do so by telling diffusers to expect the weights to be in float16 precision:
80
+
81
+
82
+ ```py
83
+ import torch
84
+
85
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, use_auth_token=True)
86
+ pipe = pipe.to(device)
87
  ```
88
 
89
  To swap out the noise scheduler, pass it to `from_pretrained`: