patrickvonplaten commited on
Commit
d6b863c
1 Parent(s): 2baddba

Update README.md

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