patrickvonplaten commited on
Commit
2b64332
1 Parent(s): 36ae9ff

Update README.md

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