Linaqruf commited on
Commit
9e00b68
1 Parent(s): 211ff7c

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +260 -0
README.md ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 5px 5px 15px 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 10px 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
+ .overlay {
89
+ position: absolute;
90
+ bottom: 0;
91
+ left: 0;
92
+ right: 0;
93
+ color: white;
94
+ width: 100%;
95
+ height: 40%;
96
+ display: flex;
97
+ flex-direction: column;
98
+ justify-content: center;
99
+ align-items: center;
100
+ font-size: 1em;
101
+ font-style: bold;
102
+ text-align: center;
103
+ opacity: 0;
104
+ /* Keep the text fully opaque */
105
+ background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 60%, rgba(0, 0, 0, 0) 100%);
106
+ transition: opacity .5s;
107
+ }
108
+
109
+ .custom-image-container:hover .overlay {
110
+ opacity: 1;
111
+ /* Make the overlay always visible */
112
+ }
113
+
114
+ .overlay-text {
115
+ background: linear-gradient(45deg, #7ed56f, #28b485);
116
+ -webkit-background-clip: text;
117
+ color: transparent;
118
+ /* Fallback for browsers that do not support this effect */
119
+ text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
120
+ /* Enhanced text shadow for better legibility */
121
+ }
122
+
123
+ .overlay-subtext {
124
+ font-size: 0.75em;
125
+ margin-top: 0.5em;
126
+ font-style: italic;
127
+ }
128
+
129
+ .overlay,
130
+ .overlay-subtext {
131
+ text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
132
+ }
133
+ </style>
134
+ <h1 class="title">
135
+ <span>Style Enhancer XL LoRA</span>
136
+ </h1>
137
+ <table class="custom-table">
138
+ <tr>
139
+ <td>
140
+ <div class="custom-image-container">
141
+ <a href="https://huggingface.co/Linaqruf/animagine-xl/blob/main/sample_images/image1.png">
142
+ <img class="custom-image" src="https://huggingface.co/Linaqruf/animagine-xl/resolve/main/sample_images/image1.png" alt="sample1">
143
+ <div class="overlay"> Twilight Whispers <div class="overlay-subtext">"A serene gaze into the dusky lights"</div>
144
+ </div>
145
+ </a>
146
+ </div>
147
+ <div class="custom-image-container">
148
+ <a href="https://huggingface.co/Linaqruf/animagine-xl/blob/main/sample_images/image4.png">
149
+ <img class="custom-image" src="https://huggingface.co/Linaqruf/animagine-xl/resolve/main/sample_images/image4.png" alt="sample4">
150
+ <div class="overlay"> Bloom of Youth <div class="overlay-subtext">"Amidst the dance of petals and sunbeams"</div>
151
+ </div>
152
+ </a>
153
+ </div>
154
+ </td>
155
+ <td>
156
+ <div class="custom-image-container">
157
+ <a href="https://huggingface.co/Linaqruf/animagine-xl/blob/main/sample_images/image2.png">
158
+ <img class="custom-image" src="https://huggingface.co/Linaqruf/animagine-xl/resolve/main/sample_images/image2.png" alt="sample2">
159
+ <div class="overlay"> Starry-eyed Dreams <div class="overlay-subtext">"Lost in the constellation of imagination"</div>
160
+ </div>
161
+ </a>
162
+ </div>
163
+ <div class="custom-image-container">
164
+ <a href="https://huggingface.co/Linaqruf/animagine-xl/blob/main/sample_images/image3.png">
165
+ <img class="custom-image" src="https://huggingface.co/Linaqruf/animagine-xl/resolve/main/sample_images/image3.png" alt="sample3">
166
+ <div class="overlay"> Sunset Serenade <div class="overlay-subtext">"A fiery glance that kindles the heart"</div>
167
+ </div>
168
+ </a>
169
+ </div>
170
+ </td>
171
+ </tr>
172
+ </table>
173
+
174
+ <hr>
175
+
176
+ ## Overview
177
+
178
+ **Style Enhancer XL LoRA** is a high resolution, LoRA adapter for Animagine XL 2.0. The model has been fine-tuned using a curated dataset of superior-quality anime-style images.
179
+
180
+ Like other anime-style Stable Diffusion models, it also supports Danbooru tags to generate images.
181
+
182
+ e.g. _**face focus, cute, masterpiece, best quality, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck**_
183
+
184
+
185
+ <hr>
186
+
187
+ ## Model Details
188
+
189
+ - **Developed by:** [Linaqruf](https://github.com/Linaqruf)
190
+ - **Model type:** LoRA adapter
191
+ - **Model Description:** This is a small model that should be used with big model and can be used to generate and modify high quality anime-themed images based on text prompts. This adapter can enhance Animagine XL 2.0 style and also get `old-school` SD 1.5 anime model artstyle.
192
+ - **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL)
193
+ - **Finetuned from model:** [Animagine XL 2.0](https://huggingface.co/Linaqruf/animagine-xl-2.0)
194
+
195
+ <hr>
196
+
197
+ ## 🧨 Diffusers
198
+
199
+ Make sure to upgrade diffusers to >= 0.23.0:
200
+ ```
201
+ pip install diffusers --upgrade
202
+ ```
203
+
204
+ In addition make sure to install `transformers`, `safetensors`, `accelerate` as well as the invisible watermark:
205
+ ```
206
+ pip install invisible_watermark transformers accelerate safetensors
207
+ ```
208
+
209
+ Running the pipeline (The default scheduler for Animagine XL 2.0 is **EulerAncestralDiscreteScheduler** but you may also declare it in the code if you want to make sure)*:
210
+ ```py
211
+ import torch
212
+ from diffusers import (
213
+ StableDiffusionXLPipeline,
214
+ EulerAncestralDiscreteScheduler,
215
+ AutoencoderKL
216
+ )
217
+
218
+ lora_model_id = "Linaqruf/style-enhancer-xl-lora"
219
+ lora_filename = "style-enhancer-xl.safetensors"
220
+
221
+ vae = AutoencoderKL.from_pretrained(
222
+ "madebyollin/sdxl-vae-fp16-fix",
223
+ torch_dtype=torch.float16
224
+ )
225
+
226
+ pipe = StableDiffusionXLPipeline.from_pretrained(
227
+ "Linaqruf/animagine-xl-2.0",
228
+ vae=vae,
229
+ torch_dtype=torch.float16,
230
+ use_safetensors=True,
231
+ variant="fp16"
232
+ )
233
+
234
+ pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
235
+ pipe.to('cuda')
236
+
237
+ pipe.load_lora_weights(lora_model_id, weight_name=lora_filename)
238
+ pipe.fuse_lora(lora_scale=0.6)
239
+
240
+ prompt = "face focus, cute, masterpiece, best quality, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck"
241
+ 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"
242
+
243
+ image = pipe(
244
+ prompt,
245
+ negative_prompt=negative_prompt,
246
+ width=1024,
247
+ height=1024,
248
+ guidance_scale=12,
249
+ num_inference_steps=50
250
+ ).images[0]
251
+
252
+ pipe.unfuse_lora()
253
+
254
+ image.save("anime_girl.png")
255
+ ```
256
+ <hr>
257
+
258
+ ## Limitation
259
+ This model inherit Stable Diffusion XL 1.0 [limitation](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0#limitations)
260
+