Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: diffusers
|
3 |
+
license: openrail++
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
tags:
|
7 |
+
- text-to-image
|
8 |
+
- stable-diffusion
|
9 |
+
- lora
|
10 |
+
- safetensors
|
11 |
+
- stable-diffusion-xl
|
12 |
+
base_model: Linaqruf/animagine-xl-2.0
|
13 |
+
widget:
|
14 |
+
- text: face focus, cute, masterpiece, best quality, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck
|
15 |
+
parameter:
|
16 |
+
negative_prompt: lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry
|
17 |
+
example_title: 1girl
|
18 |
+
- text: face focus, bishounen, masterpiece, best quality, 1boy, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck
|
19 |
+
parameter:
|
20 |
+
negative_prompt: lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry
|
21 |
+
example_title: 1boy
|
22 |
+
---
|
23 |
+
|
24 |
+
<style>
|
25 |
+
.title-container {
|
26 |
+
display: flex;
|
27 |
+
flex-direction: column; /* Allow vertical stacking of title and subtitle */
|
28 |
+
justify-content: center;
|
29 |
+
align-items: center;
|
30 |
+
height: 100vh;
|
31 |
+
background-color: #f5f5f5;
|
32 |
+
}
|
33 |
+
|
34 |
+
.title {
|
35 |
+
font-size: 2em;
|
36 |
+
text-align: center;
|
37 |
+
color: #333;
|
38 |
+
font-family: 'Verdana', sans-serif;
|
39 |
+
text-transform: uppercase;
|
40 |
+
padding: 1em;
|
41 |
+
box-shadow: 0px 0px 0px rgba(0,0,0,0.1);
|
42 |
+
}
|
43 |
+
|
44 |
+
.title span {
|
45 |
+
background: -webkit-linear-gradient(45deg, #ff9a9e, #fad0c4, #f6d365);
|
46 |
+
-webkit-background-clip: text;
|
47 |
+
-webkit-text-fill-color: transparent;
|
48 |
+
}
|
49 |
+
|
50 |
+
.custom-table {
|
51 |
+
table-layout: fixed;
|
52 |
+
width: 100%;
|
53 |
+
border-collapse: collapse;
|
54 |
+
margin-top: 2em;
|
55 |
+
}
|
56 |
+
|
57 |
+
.custom-table td {
|
58 |
+
width: 50%;
|
59 |
+
vertical-align: top;
|
60 |
+
padding: 10px;
|
61 |
+
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.15);
|
62 |
+
}
|
63 |
+
|
64 |
+
.custom-image-container {
|
65 |
+
position: relative;
|
66 |
+
width: 100%;
|
67 |
+
margin-bottom: 0em;
|
68 |
+
overflow: hidden;
|
69 |
+
border-radius: 10px;
|
70 |
+
transition: transform .7s;
|
71 |
+
/* Smooth transition for the container */
|
72 |
+
}
|
73 |
+
|
74 |
+
.custom-image-container:hover {
|
75 |
+
transform: scale(1.05);
|
76 |
+
/* Scale the container on hover */
|
77 |
+
}
|
78 |
+
|
79 |
+
.custom-image {
|
80 |
+
width: 100%;
|
81 |
+
height: auto;
|
82 |
+
object-fit: cover;
|
83 |
+
border-radius: 10px;
|
84 |
+
transition: transform .7s;
|
85 |
+
margin-bottom: 0em;
|
86 |
+
}
|
87 |
+
|
88 |
+
.nsfw-filter {
|
89 |
+
filter: blur(8px); /* Apply a blur effect */
|
90 |
+
transition: filter 0.3s ease; /* Smooth transition for the blur effect */
|
91 |
+
}
|
92 |
+
|
93 |
+
.custom-image-container:hover .nsfw-filter {
|
94 |
+
filter: none; /* Remove the blur effect on hover */
|
95 |
+
}
|
96 |
+
</style>
|
97 |
+
|
98 |
+
<h1 class="title">
|
99 |
+
<span>Anime Nouveau XL LoRA</span>
|
100 |
+
</h1>
|
101 |
+
<table class="custom-table">
|
102 |
+
<tr>
|
103 |
+
<td>
|
104 |
+
<div class="custom-image-container">
|
105 |
+
<img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/jASyf6m45S4Z2c6pGyUkj.png" alt="sample1">
|
106 |
+
</div>
|
107 |
+
<div class="custom-image-container">
|
108 |
+
<img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/918VxNc2vaLDK6jWBs0sc.png" alt="sample4">
|
109 |
+
</div>
|
110 |
+
</td>
|
111 |
+
<td>
|
112 |
+
<div class="custom-image-container">
|
113 |
+
<img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/heS29HTAdnU57ljsqpHEN.png" alt="sample2">
|
114 |
+
</div>
|
115 |
+
<div class="custom-image-container">
|
116 |
+
<img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/0zwm78LPYPXkPKin09iSk.png" alt="sample3">
|
117 |
+
</td>
|
118 |
+
</tr>
|
119 |
+
</table>
|
120 |
+
|
121 |
+
|
122 |
+
## Overview
|
123 |
+
|
124 |
+
**Anime Nouveau XL LoRA** is an innovative LoRA (Low-Rank Adaptation) adapter, meticulously crafted to work seamlessly with Animagine XL 2.0. This model is specifically designed to infuse anime-style images with the richness and intricate ornamentation characteristic of the Anime Nouveau art style. It's perfect for users looking to create anime images that are not just visually stunning but also rich in detailed artistry.
|
125 |
+
|
126 |
+
## Model Details
|
127 |
+
|
128 |
+
- **Developed by:** [Linaqruf](https://github.com/Linaqruf)
|
129 |
+
- **Model type:** LoRA adapter for Stable Diffusion XL
|
130 |
+
- **Model Description:** Anime Nouveau XL LoRA is a sophisticated model adapter that enhances the capabilities of Animagine XL 2.0 by adding an Anime Nouveau touch to the images. This style is known for its rich details and ornamental flourishes, offering a unique blend of modern anime art with a classic, detailed aesthetic.
|
131 |
+
- **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL)
|
132 |
+
- **Finetuned from model:** [Animagine XL 2.0](https://huggingface.co/Linaqruf/animagine-xl-2.0)
|
133 |
+
|
134 |
+
<hr>
|
135 |
+
|
136 |
+
## 🧨 Diffusers Installation
|
137 |
+
|
138 |
+
Ensure the installation of the latest `diffusers` library, along with other essential packages:
|
139 |
+
|
140 |
+
```bash
|
141 |
+
pip install diffusers --upgrade
|
142 |
+
pip install transformers accelerate safetensors
|
143 |
+
```
|
144 |
+
|
145 |
+
The following Python script demonstrates how to utilize the Anime Nouveau XL LoRA with Animagine XL 2.0. The default scheduler is EulerAncestralDiscreteScheduler, but it can be explicitly defined for clarity.
|
146 |
+
|
147 |
+
```py
|
148 |
+
import torch
|
149 |
+
from diffusers import (
|
150 |
+
StableDiffusionXLPipeline,
|
151 |
+
EulerAncestralDiscreteScheduler,
|
152 |
+
AutoencoderKL
|
153 |
+
)
|
154 |
+
|
155 |
+
# Initialize LoRA model and weights
|
156 |
+
lora_model_id = "Linaqruf/anime-nouveau-xl-lora"
|
157 |
+
lora_filename = "anime-nouveau-xl.safetensors"
|
158 |
+
|
159 |
+
# Load VAE component
|
160 |
+
vae = AutoencoderKL.from_pretrained(
|
161 |
+
"madebyollin/sdxl-vae-fp16-fix",
|
162 |
+
torch_dtype=torch.float16
|
163 |
+
)
|
164 |
+
|
165 |
+
# Configure the pipeline
|
166 |
+
pipe = StableDiffusionXLPipeline.from_pretrained(
|
167 |
+
"Linaqruf/animagine-xl-2.0",
|
168 |
+
vae=vae,
|
169 |
+
torch_dtype=torch.float16,
|
170 |
+
use_safetensors=True,
|
171 |
+
variant="fp16"
|
172 |
+
)
|
173 |
+
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
174 |
+
pipe.to('cuda')
|
175 |
+
|
176 |
+
# Load and fuse LoRA weights
|
177 |
+
pipe.load_lora_weights(lora_model_id, weight_name=lora_filename)
|
178 |
+
pipe.fuse_lora(lora_scale=0.6)
|
179 |
+
|
180 |
+
# Define prompts and generate image
|
181 |
+
prompt = "face focus, cute, masterpiece, best quality, 1girl, sketch, monochrome, greyscale, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck"
|
182 |
+
negative_prompt = "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry"
|
183 |
+
|
184 |
+
image = pipe(
|
185 |
+
prompt,
|
186 |
+
negative_prompt=negative_prompt,
|
187 |
+
width=1024,
|
188 |
+
height=1024,
|
189 |
+
guidance_scale=12,
|
190 |
+
num_inference_steps=50
|
191 |
+
).images[0]
|
192 |
+
|
193 |
+
# Unfuse LoRA before saving the image
|
194 |
+
pipe.unfuse_lora()
|
195 |
+
image.save("anime_girl.png")
|
196 |
+
|
197 |
+
```
|