patrickvonplaten commited on
Commit
0ec5e09
1 Parent(s): 47cced5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -7
README.md CHANGED
@@ -59,7 +59,8 @@ Run this command to log in with your HF Hub token if you haven't before:
59
  huggingface-cli login
60
  ```
61
 
62
- Running the pipeline with the default PLMS scheduler:
 
63
  ```python
64
  import torch
65
  from torch import autocast
@@ -68,15 +69,20 @@ from diffusers import StableDiffusionPipeline
68
  model_id = "CompVis/stable-diffusion-v1-1"
69
  device = "cuda"
70
 
71
- generator = torch.Generator(device=device).manual_seed(0)
72
  pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
73
  pipe = pipe.to(device)
 
74
 
75
- prompt = "a photograph of an astronaut riding a horse"
76
- with autocast("cuda"):
77
- image = pipe(prompt, generator=generator)["sample"][0] # image here is in PIL format
78
-
79
- image.save(f"astronaut_rides_horse.png")
 
 
 
 
80
  ```
81
 
82
  To swap out the noise scheduler, pass it to `from_pretrained`:
 
59
  huggingface-cli login
60
  ```
61
 
62
+ Running the pipeline with the default PNDM scheduler:
63
+
64
  ```python
65
  import torch
66
  from torch import autocast
 
69
  model_id = "CompVis/stable-diffusion-v1-1"
70
  device = "cuda"
71
 
72
+
73
  pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
74
  pipe = pipe.to(device)
75
+ ```
76
 
77
+ **Note**:
78
+ 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:
79
+
80
+
81
+ ```py
82
+ import torch
83
+
84
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, use_auth_token=True)
85
+ pipe = pipe.to(device)
86
  ```
87
 
88
  To swap out the noise scheduler, pass it to `from_pretrained`: