Update README.md
Browse files
README.md
CHANGED
|
@@ -33,20 +33,21 @@ You should use `platypus` to trigger the image generation.
|
|
| 33 |
|
| 34 |
```python
|
| 35 |
import torch
|
| 36 |
-
from diffusers import DiffusionPipeline
|
|
|
|
| 37 |
|
| 38 |
# switch to "mps" for apple devices
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
| 41 |
|
| 42 |
prompt = "platypus"
|
| 43 |
-
image =
|
| 44 |
```
|
| 45 |
|
| 46 |
## Varying The LoRA Scale
|
| 47 |
```python
|
| 48 |
-
import matplotlib.pyplot as plt
|
| 49 |
-
|
| 50 |
gen_images=[]
|
| 51 |
lora_scales = [0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4]
|
| 52 |
for lora_scale in lora_scales:
|
|
@@ -57,7 +58,6 @@ for lora_scale in lora_scales:
|
|
| 57 |
height=512,
|
| 58 |
width=512,
|
| 59 |
cross_attention_kwargs={"scale": lora_scale},
|
| 60 |
-
clip_skip=2,
|
| 61 |
generator=torch.manual_seed(0)
|
| 62 |
).images[0]
|
| 63 |
|
|
|
|
| 33 |
|
| 34 |
```python
|
| 35 |
import torch
|
| 36 |
+
from diffusers import DiffusionPipeline,DDIMScheduler
|
| 37 |
+
import matplotlib.pyplot as plt
|
| 38 |
|
| 39 |
# switch to "mps" for apple devices
|
| 40 |
+
pipeline = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", dtype=torch.bfloat16, device_map="cuda")
|
| 41 |
+
pipeline.load_lora_weights("Mohan-diffuser/lora_platypus_sd_15")
|
| 42 |
+
|
| 43 |
+
pipeline.scheduler = DDIMScheduler.from_config(pipeline.scheduler.config)
|
| 44 |
|
| 45 |
prompt = "platypus"
|
| 46 |
+
image = pipeline(prompt).images[0]
|
| 47 |
```
|
| 48 |
|
| 49 |
## Varying The LoRA Scale
|
| 50 |
```python
|
|
|
|
|
|
|
| 51 |
gen_images=[]
|
| 52 |
lora_scales = [0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4]
|
| 53 |
for lora_scale in lora_scales:
|
|
|
|
| 58 |
height=512,
|
| 59 |
width=512,
|
| 60 |
cross_attention_kwargs={"scale": lora_scale},
|
|
|
|
| 61 |
generator=torch.manual_seed(0)
|
| 62 |
).images[0]
|
| 63 |
|