KaraKaraWitch
commited on
Commit
·
b000f13
1
Parent(s):
c5b8a52
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
---
|
4 |
+
|
5 |
+
# WD 1.5 Beta 3 (Diffusers-compatible)
|
6 |
+
|
7 |
+
<img width="582px" height="256px" src="https://birchlabs.co.uk/share/radiance0triptych.jpg" title="Triptych of Reimu, Sanae and Flandre in 'radiance' aesthetic">
|
8 |
+
|
9 |
+
This unofficial repository hosts diffusers-compatible float16 checkpoints of WD 1.5 beta 3.
|
10 |
+
Float16 is [all you need](https://twitter.com/Birchlabs/status/1599903883278663681) for inference.
|
11 |
+
|
12 |
+
NOTE: This version only hosts the base model as it is meant for finetuning with everydream2trainer (Whic does not support safetensors for some reason)
|
13 |
+
|
14 |
+
## Usage (via diffusers)
|
15 |
+
|
16 |
+
```python
|
17 |
+
# make sure you're logged in with `huggingface-cli login`
|
18 |
+
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
|
19 |
+
from diffusers.models.autoencoder_kl import AutoencoderKL
|
20 |
+
from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput
|
21 |
+
import torch
|
22 |
+
from torch import Generator, compile
|
23 |
+
from PIL import Image
|
24 |
+
from typing import List
|
25 |
+
|
26 |
+
vae: AutoencoderKL = AutoencoderKL.from_pretrained('hakurei/waifu-diffusion', subfolder='vae', torch_dtype=torch.float16)
|
27 |
+
|
28 |
+
# scheduler args documented here:
|
29 |
+
# https://github.com/huggingface/diffusers/blob/0392eceba8d42b24fcecc56b2cc1f4582dbefcc4/src/diffusers/schedulers/scheduling_dpmsolver_multistep.py#L83
|
30 |
+
scheduler: DPMSolverMultistepScheduler = DPMSolverMultistepScheduler.from_pretrained(
|
31 |
+
'Birchlabs/wd-1-5-beta3-unofficial',
|
32 |
+
subfolder='scheduler',
|
33 |
+
# sde-dpmsolver++ is very new. if your diffusers version doesn't have it: use 'dpmsolver++' instead.
|
34 |
+
algorithm_type='sde-dpmsolver++',
|
35 |
+
solver_order=2,
|
36 |
+
# solver_type='heun' may give a sharper image. Cheng Lu reckons midpoint is better.
|
37 |
+
solver_type='midpoint',
|
38 |
+
use_karras_sigmas=True,
|
39 |
+
)
|
40 |
+
|
41 |
+
# variant=None
|
42 |
+
# variant='ink'
|
43 |
+
# variant='mofu'
|
44 |
+
variant='radiance'
|
45 |
+
# variant='illusion'
|
46 |
+
pipe: StableDiffusionPipeline = StableDiffusionPipeline.from_pretrained(
|
47 |
+
'Birchlabs/wd-1-5-beta3-unofficial',
|
48 |
+
torch_dtype=torch.float16,
|
49 |
+
vae=vae,
|
50 |
+
scheduler=scheduler,
|
51 |
+
variant=variant,
|
52 |
+
)
|
53 |
+
pipe.to('cuda')
|
54 |
+
compile(pipe.unet, mode='reduce-overhead')
|
55 |
+
|
56 |
+
# WD1.5 was trained on area=896**2 and no side longer than 1152
|
57 |
+
sqrt_area=896
|
58 |
+
# note: pipeline requires width and height to be multiples of 8
|
59 |
+
height = 1024
|
60 |
+
width = sqrt_area**2//height
|
61 |
+
|
62 |
+
prompt = 'artoria pendragon (fate), reddizen, 1girl, best aesthetic, best quality, blue dress, full body, white shirt, blonde hair, looking at viewer, hair between eyes, floating hair, green eyes, blue ribbon, long sleeves, juliet sleeves, light smile, hair ribbon, outdoors, painting (medium), traditional media'
|
63 |
+
negative_prompt = 'lowres, bad anatomy, bad hands, missing fingers, extra fingers, blurry, mutation, deformed face, ugly, bad proportions, monster, cropped, worst quality, jpeg, bad posture, long body, long neck, jpeg artifacts, deleted, bad aesthetic, realistic, real life, instagram'
|
64 |
+
|
65 |
+
# pipeline invocation args documented here:
|
66 |
+
# https://github.com/huggingface/diffusers/blob/0392eceba8d42b24fcecc56b2cc1f4582dbefcc4/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#LL544C18-L544C18
|
67 |
+
out: StableDiffusionPipelineOutput = pipe.__call__(
|
68 |
+
prompt,
|
69 |
+
negative_prompt=negative_prompt,
|
70 |
+
height=height,
|
71 |
+
width=width,
|
72 |
+
num_inference_steps=22,
|
73 |
+
generator=Generator().manual_seed(1234)
|
74 |
+
)
|
75 |
+
images: List[Image.Image] = out.images
|
76 |
+
img, *_ = images
|
77 |
+
|
78 |
+
img.save('out_pipe/saber.png')
|
79 |
+
```
|
80 |
+
|
81 |
+
Should output the following image:
|
82 |
+
|
83 |
+
<img height="256px" src="https://birchlabs.co.uk/share/saber-radiance.smol.jpg" title="Saber in 'radiance' aesthetic">
|
84 |
+
|
85 |
+
## Original model card
|
86 |
+
|
87 |
+
![WD 1.5 Radiance](https://i.ibb.co/hYjgvGZ/00160-2195473148.png)
|
88 |
+
|
89 |
+
For this release, we release five versions of the model:
|
90 |
+
|
91 |
+
- WD 1.5 Beta3 Base
|
92 |
+
- WD 1.5 Radiance
|
93 |
+
- WD 1.5 Ink
|
94 |
+
- WD 1.5 Mofu
|
95 |
+
- WD 1.5 Illusion
|
96 |
+
|
97 |
+
The WD 1.5 Base model is only intended for training use. For generation, it is recomended to create your own finetunes and loras on top of WD 1.5 Base or use one of the aesthetic models. More information and sample generations for the aesthetic models are in the release notes
|
98 |
+
|
99 |
+
### Release Notes
|
100 |
+
|
101 |
+
https://saltacc.notion.site/WD-1-5-Beta-3-Release-Notes-1e35a0ed1bb24c5b93ec79c45c217f63
|
102 |
+
# VAE
|
103 |
+
WD 1.5 uses the same VAE as WD 1.4, which can be found here https://huggingface.co/hakurei/waifu-diffusion-v1-4/blob/main/vae/kl-f8-anime2.ckpt
|
104 |
+
|
105 |
+
|
106 |
+
## License
|
107 |
+
WD 1.5 is released under the Fair AI Public License 1.0-SD (https://freedevproject.org/faipl-1.0-sd/). If any derivative of this model is made, please share your changes accordingly. Special thanks to ronsor/undeleted (https://undeleted.ronsor.com/) for help with the license.
|