Update README.md
Browse files
README.md
CHANGED
|
@@ -21,27 +21,27 @@ Here is a simple example:
|
|
| 21 |
import torch
|
| 22 |
from diffusers import StableDiffusionPipeline, TCDScheduler
|
| 23 |
|
| 24 |
-
device
|
| 25 |
-
base_model_id
|
| 26 |
-
tcd_lora_id
|
| 27 |
|
| 28 |
-
pipe
|
| 29 |
-
pipe.scheduler
|
| 30 |
|
| 31 |
pipe.load_lora_weights(tcd_lora_id)
|
| 32 |
pipe.fuse_lora()
|
| 33 |
|
| 34 |
-
prompt
|
| 35 |
|
| 36 |
-
image
|
| 37 |
-
prompt
|
| 38 |
-
num_inference_steps
|
| 39 |
-
guidance_scale
|
| 40 |
-
# Eta (referred to as
|
| 41 |
# A value of 0.3 often yields good results.
|
| 42 |
# We recommend using a higher eta when increasing the number of inference steps.
|
| 43 |
-
eta
|
| 44 |
-
generator
|
| 45 |
).images[0]
|
| 46 |
```
|
| 47 |
|
|
|
|
| 21 |
import torch
|
| 22 |
from diffusers import StableDiffusionPipeline, TCDScheduler
|
| 23 |
|
| 24 |
+
device = "cuda"
|
| 25 |
+
base_model_id = "stabilityai/stable-diffusion-2-1-base"
|
| 26 |
+
tcd_lora_id = "h1t/TCD-SD21-base-LoRA"
|
| 27 |
|
| 28 |
+
pipe = StableDiffusionPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16, variant="fp16").to(device)
|
| 29 |
+
pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
|
| 30 |
|
| 31 |
pipe.load_lora_weights(tcd_lora_id)
|
| 32 |
pipe.fuse_lora()
|
| 33 |
|
| 34 |
+
prompt = "Beautiful woman, bubblegum pink, lemon yellow, minty blue, futuristic, high-detail, epic composition, watercolor."
|
| 35 |
|
| 36 |
+
image = pipe(
|
| 37 |
+
prompt=prompt,
|
| 38 |
+
num_inference_steps=4,
|
| 39 |
+
guidance_scale=0,
|
| 40 |
+
# Eta (referred to as `gamma` in the paper) is used to control the stochasticity in every step.
|
| 41 |
# A value of 0.3 often yields good results.
|
| 42 |
# We recommend using a higher eta when increasing the number of inference steps.
|
| 43 |
+
eta=0.3,
|
| 44 |
+
generator=torch.Generator(device=device).manual_seed(0),
|
| 45 |
).images[0]
|
| 46 |
```
|
| 47 |
|