Update README.md
Browse files
README.md
CHANGED
|
@@ -46,35 +46,6 @@ image = pipe(
|
|
| 46 |
image.save("img_sdxl.png")
|
| 47 |
```
|
| 48 |
|
| 49 |
-
### SDXL(LoRA)
|
| 50 |
-
```python
|
| 51 |
-
from diffusers import StableDiffusionXLPipeline, AutoencoderKL
|
| 52 |
-
import torch
|
| 53 |
-
|
| 54 |
-
vae = AutoencoderKL.from_pretrained(
|
| 55 |
-
'madebyollin/sdxl-vae-fp16-fix',
|
| 56 |
-
torch_dtype=torch.float16,
|
| 57 |
-
)
|
| 58 |
-
pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 59 |
-
'stabilityai/stable-diffusion-xl-base-1.0',
|
| 60 |
-
vae=vae,
|
| 61 |
-
torch_dtype=torch.float16
|
| 62 |
-
)
|
| 63 |
-
pipe.load_lora_weights("casiatao/LPO", weight_name="lpo_sdxl_lora/pytorch_lora_weights.safetensors")
|
| 64 |
-
pipe = pipe.to("cuda")
|
| 65 |
-
|
| 66 |
-
prompt = "A cat holding a sign that says hello world"
|
| 67 |
-
|
| 68 |
-
generator=torch.Generator(device="cuda").manual_seed(42)
|
| 69 |
-
image = pipe(
|
| 70 |
-
prompt=prompt,
|
| 71 |
-
guidance_scale=5.0,
|
| 72 |
-
num_inference_steps=20,
|
| 73 |
-
generator=generator,
|
| 74 |
-
output_type='pil',
|
| 75 |
-
).images[0]
|
| 76 |
-
image.save("img_sdxl_lora.png")
|
| 77 |
-
```
|
| 78 |
|
| 79 |
### SD1.5
|
| 80 |
```python
|
|
@@ -106,30 +77,6 @@ image = pipe(
|
|
| 106 |
image.save("img_sd15.png")
|
| 107 |
```
|
| 108 |
|
| 109 |
-
### SD1.5(LoRA)
|
| 110 |
-
```python
|
| 111 |
-
from diffusers import StableDiffusionPipeline
|
| 112 |
-
import torch
|
| 113 |
-
|
| 114 |
-
pipe = StableDiffusionPipeline.from_pretrained(
|
| 115 |
-
'sd-legacy/stable-diffusion-v1-5',
|
| 116 |
-
torch_dtype=torch.float16
|
| 117 |
-
)
|
| 118 |
-
pipe.load_lora_weights("casiatao/LPO", weight_name="lpo_sd15_lora/pytorch_lora_weights.safetensors")
|
| 119 |
-
pipe = pipe.to("cuda")
|
| 120 |
-
|
| 121 |
-
prompt = "a photo of a cat"
|
| 122 |
-
|
| 123 |
-
generator=torch.Generator(device="cuda").manual_seed(42)
|
| 124 |
-
image = pipe(
|
| 125 |
-
prompt=prompt,
|
| 126 |
-
guidance_scale=5.0,
|
| 127 |
-
num_inference_steps=20,
|
| 128 |
-
generator=generator,
|
| 129 |
-
output_type='pil',
|
| 130 |
-
).images[0]
|
| 131 |
-
image.save("img_sd15_lora.png")
|
| 132 |
-
```
|
| 133 |
|
| 134 |
|
| 135 |
## ❤️ Citation
|
|
|
|
| 46 |
image.save("img_sdxl.png")
|
| 47 |
```
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
### SD1.5
|
| 51 |
```python
|
|
|
|
| 77 |
image.save("img_sd15.png")
|
| 78 |
```
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
|
| 82 |
## ❤️ Citation
|