Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
tags:
|
5 |
+
- stable-diffusion
|
6 |
+
- text-to-image
|
7 |
+
license: bigscience-bloom-rail-1.0
|
8 |
+
inference: false
|
9 |
+
|
10 |
+
---
|
11 |
+
|
12 |
+
# waifu-diffusion - Diffusion for Weebs
|
13 |
+
|
14 |
+
waifu-diffusion is a latent text-to-image diffusion model that has been conditioned on high-quality anime images through fine-tuning.
|
15 |
+
|
16 |
+
# Gradio
|
17 |
+
|
18 |
+
We also support a [Gradio](https://github.com/gradio-app/gradio) web ui with diffusers to run inside a colab notebook:
|
19 |
+
|
20 |
+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1_8wPN7dJO746QXsFnB09Uq2VGgSRFuYE#scrollTo=1HaCauSq546O)
|
21 |
+
|
22 |
+
<img src=https://cdn.discordapp.com/attachments/930559077170421800/1017265913231327283/unknown.png width=40% height=40%>
|
23 |
+
|
24 |
+
[Original PyTorch Model Download Link](https://thisanimedoesnotexist.ai/downloads/wd-v1-2-full-ema.ckpt)
|
25 |
+
|
26 |
+
## Model Description
|
27 |
+
|
28 |
+
The model originally used for fine-tuning is [Stable Diffusion V1-4](https://huggingface.co/CompVis/stable-diffusion-v1-4), which is a latent image diffusion model trained on [LAION2B-en](https://huggingface.co/datasets/laion/laion2B-en).
|
29 |
+
|
30 |
+
The current model has been fine-tuned with a learning rate of 5.0e-6 for 4 epochs on 56k text-image pairs obtained through Danbooru which all have an aesthetic rating greater than `6.0`.
|
31 |
+
|
32 |
+
**Note:** This project has **no affiliation with Danbooru.**
|
33 |
+
|
34 |
+
## Training Data & Annotative Prompting
|
35 |
+
|
36 |
+
The data used for fine-tuning has come from a random sample of 56k Danbooru images, which were filtered based on [CLIP Aesthetic Scoring](https://github.com/christophschuhmann/improved-aesthetic-predictor) where only images with an aesthetic score greater than `6.0` were used.
|
37 |
+
|
38 |
+
## License
|
39 |
+
|
40 |
+
This model is open access and available to all, with a CreativeML OpenRAIL-M license further specifying rights and usage.
|
41 |
+
The CreativeML OpenRAIL License specifies:
|
42 |
+
|
43 |
+
1. You can't use the model to deliberately produce nor share illegal or harmful outputs or content
|
44 |
+
2. The authors claims no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in the license
|
45 |
+
3. You may re-distribute the weights and use the model commercially and/or as a service. If you do, please be aware you have to include the same use restrictions as the ones in the license and share a copy of the CreativeML OpenRAIL-M to all your users (please read the license entirely and carefully)
|
46 |
+
[Please read the full license here](https://huggingface.co/spaces/CompVis/stable-diffusion-license)
|
47 |
+
|
48 |
+
## Downstream Uses
|
49 |
+
|
50 |
+
This model can be used for entertainment purposes and as a generative art assistant.
|
51 |
+
|
52 |
+
## Example Code
|
53 |
+
|
54 |
+
```python
|
55 |
+
import torch
|
56 |
+
from torch import autocast
|
57 |
+
from diffusers import StableDiffusionPipeline, DDIMScheduler
|
58 |
+
|
59 |
+
model_id = "hakurei/waifu-diffusion"
|
60 |
+
device = "cuda"
|
61 |
+
|
62 |
+
|
63 |
+
pipe = StableDiffusionPipeline.from_pretrained(
|
64 |
+
model_id,
|
65 |
+
torch_dtype=torch.float16,
|
66 |
+
revision="fp16",
|
67 |
+
scheduler=DDIMScheduler(
|
68 |
+
beta_start=0.00085,
|
69 |
+
beta_end=0.012,
|
70 |
+
beta_schedule="scaled_linear",
|
71 |
+
clip_sample=False,
|
72 |
+
set_alpha_to_one=False,
|
73 |
+
),
|
74 |
+
)
|
75 |
+
pipe = pipe.to(device)
|
76 |
+
|
77 |
+
prompt = "touhou hakurei_reimu 1girl solo portrait"
|
78 |
+
with autocast("cuda"):
|
79 |
+
image = pipe(prompt, guidance_scale=7.5)["sample"][0]
|
80 |
+
|
81 |
+
image.save("reimu_hakurei.png")
|
82 |
+
```
|
83 |
+
|
84 |
+
## Team Members and Acknowledgements
|
85 |
+
|
86 |
+
This project would not have been possible without the incredible work by the [CompVis Researchers](https://ommer-lab.com/).
|
87 |
+
|
88 |
+
- [Anthony Mercurio](https://github.com/harubaru)
|
89 |
+
- [Salt](https://github.com/sALTaccount/)
|
90 |
+
- [Sta @ Bit192](https://twitter.com/naclbbr)
|
91 |
+
|
92 |
+
In order to reach us, you can join our [Discord server](https://discord.gg/touhouai).
|
93 |
+
|
94 |
+
[![Discord Server](https://discordapp.com/api/guilds/930499730843250783/widget.png?style=banner2)](https://discord.gg/touhouai)
|