patrickvonplaten
commited on
Commit
•
3b4d7c7
1
Parent(s):
7eaa7d0
Update README.md
Browse files
README.md
CHANGED
@@ -74,6 +74,12 @@ device = "cuda"
|
|
74 |
|
75 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
|
76 |
pipe = pipe.to(device)
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
```
|
78 |
|
79 |
**Note**:
|
@@ -83,8 +89,14 @@ If you are limited by GPU memory and have less than 10GB of GPU RAM available, p
|
|
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`:
|
@@ -97,6 +109,12 @@ model_id = "CompVis/stable-diffusion-v1-1"
|
|
97 |
scheduler = LMSDiscreteScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear", num_train_timesteps=1000)
|
98 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, use_auth_token=True)
|
99 |
pipe = pipe.to("cuda")
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
```
|
101 |
|
102 |
# Uses
|
|
|
74 |
|
75 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
|
76 |
pipe = pipe.to(device)
|
77 |
+
|
78 |
+
prompt = "a photo of an astronaut riding a horse on mars"
|
79 |
+
with autocast("cuda"):
|
80 |
+
image = pipe(prompt, guidance_scale=7.5)["sample"][0]
|
81 |
+
|
82 |
+
image.save("astronaut_rides_horse.png")
|
83 |
```
|
84 |
|
85 |
**Note**:
|
|
|
89 |
```py
|
90 |
import torch
|
91 |
|
92 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision="fp16", use_auth_token=True)
|
93 |
pipe = pipe.to(device)
|
94 |
+
|
95 |
+
prompt = "a photo of an astronaut riding a horse on mars"
|
96 |
+
with autocast("cuda"):
|
97 |
+
image = pipe(prompt, guidance_scale=7.5)["sample"][0]
|
98 |
+
|
99 |
+
image.save("astronaut_rides_horse.png")
|
100 |
```
|
101 |
|
102 |
To swap out the noise scheduler, pass it to `from_pretrained`:
|
|
|
109 |
scheduler = LMSDiscreteScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule="scaled_linear", num_train_timesteps=1000)
|
110 |
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, use_auth_token=True)
|
111 |
pipe = pipe.to("cuda")
|
112 |
+
|
113 |
+
prompt = "a photo of an astronaut riding a horse on mars"
|
114 |
+
with autocast("cuda"):
|
115 |
+
image = pipe(prompt, guidance_scale=7.5)["sample"][0]
|
116 |
+
|
117 |
+
image.save("astronaut_rides_horse.png")
|
118 |
```
|
119 |
|
120 |
# Uses
|