Update README.md
Browse files
README.md
CHANGED
@@ -16,7 +16,7 @@ inference: true
|
|
16 |
should probably proofread and complete it, then remove this comment. -->
|
17 |
|
18 |
|
19 |
-
# LoRA
|
20 |
|
21 |
These are LoRA adaption weights for stabilityai/stable-diffusion-xl-base-1.0. The weights were fine-tuned on illustrations from [Maria Sibylla Merian’s Metamorphosis Insectorum Surinamensium (1705)](https://huggingface.co/datasets/jonathandinu/merian-metamorphosis).
|
22 |
|
@@ -31,10 +31,48 @@ Special VAE used for training: madebyollin/sdxl-vae-fp16-fix.
|
|
31 |
|
32 |
## Intended uses & limitations
|
33 |
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
```python
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
```
|
39 |
|
40 |
#### Limitations and bias
|
|
|
16 |
should probably proofread and complete it, then remove this comment. -->
|
17 |
|
18 |
|
19 |
+
# LoRA fine-tuning - jonathandinu/sdxl-metamorphosis
|
20 |
|
21 |
These are LoRA adaption weights for stabilityai/stable-diffusion-xl-base-1.0. The weights were fine-tuned on illustrations from [Maria Sibylla Merian’s Metamorphosis Insectorum Surinamensium (1705)](https://huggingface.co/datasets/jonathandinu/merian-metamorphosis).
|
22 |
|
|
|
31 |
|
32 |
## Intended uses & limitations
|
33 |
|
34 |
+
### How to use
|
35 |
+
|
36 |
+
#### text2img
|
37 |
+
|
38 |
+
```python
|
39 |
+
from diffusers import DiffusionPipeline, AutoencoderKL, utils
|
40 |
+
|
41 |
+
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
42 |
+
|
43 |
+
pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", vae=vae, torch_dtype=torch.float16, variant="fp16")
|
44 |
+
pipeline.to("cuda")
|
45 |
+
|
46 |
+
pipeline.load_lora_weights("jonathandinu/sdxl-metamorphosis-lora", weight_name="pytorch_lora_weights.safetensors")
|
47 |
+
|
48 |
+
pipeline(
|
49 |
+
prompt="an astronaut in the jungle",
|
50 |
+
num_inference_steps=30,
|
51 |
+
generator=torch.manual_seed(1)
|
52 |
+
).images[0]
|
53 |
+
```
|
54 |
+
|
55 |
+
#### img2img
|
56 |
|
57 |
```python
|
58 |
+
from diffusers import AutoPipelineForImage2Image
|
59 |
+
|
60 |
+
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/img2img-sdxl-init.png"
|
61 |
+
|
62 |
+
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
63 |
+
|
64 |
+
pipeline = AutoPipelineForImage2Image.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", vae=vae, torch_dtype=torch.float16, variant="fp16")
|
65 |
+
pipeline.to("cuda")
|
66 |
+
|
67 |
+
pipeline.load_lora_weights("jonathandinu/sdxl-metamorphosis-lora", weight_name="pytorch_lora_weights.safetensors")
|
68 |
+
|
69 |
+
pipeline(
|
70 |
+
prompt="an astronaut in the jungle",
|
71 |
+
image=init_image,
|
72 |
+
num_inference_steps=30,
|
73 |
+
generator=torch.manual_seed(1),
|
74 |
+
strength=0.7
|
75 |
+
).images[0]
|
76 |
```
|
77 |
|
78 |
#### Limitations and bias
|