Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>Pastel Style 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/Q1olwlimSCLG061XX6mRV.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/c29eOaqc_7BXFRKBfGn4J.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/OyiZlzjXwZ_k58QfDgcB0.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/oI1huB1ug5jMCjqqHoQVz.png" alt="sample3">
|
117 |
+
</td>
|
118 |
+
</tr>
|
119 |
+
</table>
|
120 |
+
|
121 |
+
<hr>
|
122 |
+
|
123 |
+
## Overview
|
124 |
+
|
125 |
+
**Pastel Style XL LoRA** is a specialized LoRA (Low-Rank Adaptation) adapter, expertly designed to work in conjunction with Animagine XL 2.0. This model specifically focuses on enhancing and imparting a pastel-style aesthetic to anime-themed images. It integrates smoothly with the Stable Diffusion framework, offering a unique capability to produce images with soft, pastel-like qualities without the need for specific keywords or tags.
|
126 |
+
<hr>
|
127 |
+
|
128 |
+
## Model Details
|
129 |
+
|
130 |
+
- **Developed by:** [Linaqruf](https://github.com/Linaqruf)
|
131 |
+
- **Model type:** LoRA adapter for Stable Diffusion XL
|
132 |
+
- **Model Description:** Pastel Style XL LoRA is a compact yet potent model aimed at augmenting the output of larger models, particularly Animagine XL 2.0. It's adept at generating and modifying high-quality anime-themed images, giving them a distinctive pastel aesthetic. This model is an excellent choice for those seeking to add a gentle, pastel touch to their anime creations.
|
133 |
+
- **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL)
|
134 |
+
- **Finetuned from model:** [Animagine XL 2.0](https://huggingface.co/Linaqruf/animagine-xl-2.0)
|
135 |
+
|
136 |
+
<hr>
|
137 |
+
|
138 |
+
## 🧨 Diffusers Installation
|
139 |
+
|
140 |
+
Ensure the installation of the latest `diffusers` library, along with other essential packages:
|
141 |
+
|
142 |
+
```bash
|
143 |
+
pip install diffusers --upgrade
|
144 |
+
pip install transformers accelerate safetensors
|
145 |
+
```
|
146 |
+
|
147 |
+
The following Python script demonstrates how to utilize the LoRA with Animagine XL 2.0. The default scheduler is EulerAncestralDiscreteScheduler, but it can be explicitly defined for clarity.
|
148 |
+
|
149 |
+
```py
|
150 |
+
import torch
|
151 |
+
from diffusers import (
|
152 |
+
StableDiffusionXLPipeline,
|
153 |
+
EulerAncestralDiscreteScheduler,
|
154 |
+
AutoencoderKL
|
155 |
+
)
|
156 |
+
|
157 |
+
# Initialize LoRA model and weights
|
158 |
+
lora_model_id = "Linaqruf/pastel-style-xl-lora"
|
159 |
+
lora_filename = "pastel-style-xl-v2.safetensors"
|
160 |
+
|
161 |
+
# Load VAE component
|
162 |
+
vae = AutoencoderKL.from_pretrained(
|
163 |
+
"madebyollin/sdxl-vae-fp16-fix",
|
164 |
+
torch_dtype=torch.float16
|
165 |
+
)
|
166 |
+
|
167 |
+
# Configure the pipeline
|
168 |
+
pipe = StableDiffusionXLPipeline.from_pretrained(
|
169 |
+
"Linaqruf/animagine-xl-2.0",
|
170 |
+
vae=vae,
|
171 |
+
torch_dtype=torch.float16,
|
172 |
+
use_safetensors=True,
|
173 |
+
variant="fp16"
|
174 |
+
)
|
175 |
+
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
176 |
+
pipe.to('cuda')
|
177 |
+
|
178 |
+
# Load and fuse LoRA weights
|
179 |
+
pipe.load_lora_weights(lora_model_id, weight_name=lora_filename)
|
180 |
+
pipe.fuse_lora(lora_scale=0.6)
|
181 |
+
|
182 |
+
# Define prompts and generate image
|
183 |
+
prompt = "face focus, cute, masterpiece, best quality, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck"
|
184 |
+
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"
|
185 |
+
|
186 |
+
image = pipe(
|
187 |
+
prompt,
|
188 |
+
negative_prompt=negative_prompt,
|
189 |
+
width=1024,
|
190 |
+
height=1024,
|
191 |
+
guidance_scale=12,
|
192 |
+
num_inference_steps=50
|
193 |
+
).images[0]
|
194 |
+
|
195 |
+
# Unfuse LoRA before saving the image
|
196 |
+
pipe.unfuse_lora()
|
197 |
+
image.save("anime_girl.png")
|
198 |
+
|
199 |
+
```
|