atatakun commited on
Commit
0ce7130
·
verified ·
1 Parent(s): f1f0f84

Upload 2 files

Browse files
README.md CHANGED
@@ -1,3 +1,417 @@
1
  ---
2
- license: openrail++
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: other
3
+ license_name: faipl-1.0-sd
4
+ license_link: https://freedevproject.org/faipl-1.0-sd/
5
+ language:
6
+ - en
7
+ tags:
8
+ - coreml
9
+ - text-to-image
10
+ - stable-diffusion-xl
11
  ---
12
+
13
+ base_model: Linaqruf/animagine-xl-2.0
14
+ widget:
15
+ - text: 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck, masterpiece, best quality
16
+ parameter:
17
+ negative_prompt: nsfw, 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, artist name
18
+ example_title: 1girl
19
+ - text: 1boy, male focus, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck, masterpiece, best quality
20
+ parameter:
21
+ negative_prompt: nsfw, 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, artist name
22
+ example_title: 1boy
23
+ ---
24
+
25
+ <style>
26
+ .title-container {
27
+ display: flex;
28
+ justify-content: center;
29
+ align-items: center;
30
+ height: 100vh; /* Adjust this value to position the title vertically */
31
+ }
32
+
33
+ .title {
34
+ font-size: 2.5em;
35
+ text-align: center;
36
+ color: #333;
37
+ font-family: 'Helvetica Neue', sans-serif;
38
+ text-transform: uppercase;
39
+ letter-spacing: 0.1em;
40
+ padding: 0.5em 0;
41
+ background: transparent;
42
+ }
43
+
44
+ .title span {
45
+ background: -webkit-linear-gradient(45deg, #7ed56f, #28b485);
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
+
97
+ .overlay {
98
+ position: absolute;
99
+ bottom: 0;
100
+ left: 0;
101
+ right: 0;
102
+ color: white;
103
+ width: 100%;
104
+ height: 40%;
105
+ display: flex;
106
+ flex-direction: column;
107
+ justify-content: center;
108
+ align-items: center;
109
+ font-size: 1vw;
110
+ font-style: bold;
111
+ text-align: center;
112
+ opacity: 0;
113
+ /* Keep the text fully opaque */
114
+ background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 60%, rgba(0, 0, 0, 0) 100%);
115
+ transition: opacity .5s;
116
+ }
117
+ .custom-image-container:hover .overlay {
118
+ opacity: 1;
119
+ /* Make the overlay always visible */
120
+ }
121
+ .overlay-text {
122
+ background: linear-gradient(45deg, #7ed56f, #28b485);
123
+ -webkit-background-clip: text;
124
+ color: transparent;
125
+ /* Fallback for browsers that do not support this effect */
126
+ text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
127
+ /* Enhanced text shadow for better legibility */
128
+
129
+ .overlay-subtext {
130
+ font-size: 0.75em;
131
+ margin-top: 0.5em;
132
+ font-style: italic;
133
+ }
134
+
135
+ .overlay,
136
+ .overlay-subtext {
137
+ text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
138
+ }
139
+
140
+ </style>
141
+
142
+
143
+ # Core ML Converted SDXL Model:
144
+
145
+ - This model was converted to [Core ML for use on Apple Silicon devices](https://github.com/apple/ml-stable-diffusion). Conversion instructions can be found [here](https://github.com/godly-devotion/MochiDiffusion/wiki/How-to-convert-ckpt-or-safetensors-files-to-Core-ML).
146
+ - Provide the model to an app such as **Mochi Diffusion** [Github](https://github.com/godly-devotion/MochiDiffusion) / [Discord](https://discord.gg/x2kartzxGv) to generate images.
147
+ - `original` version is only compatible with `CPU & GPU` option
148
+ - `sprit_einsum` version takes **about 5-10 minutes** to load the model for the first time and is available for both `CPU & Neural Engine` and `CPU & GPU` options. If your Mac has a lot of GPUs, using the CPU & GPU option will speed up image generation.
149
+ - Resolution and bit size are as noted in the individual file names.
150
+ - This model requires macOS 14.0 or later to run properly.
151
+ - This model was converted with a `vae-encoder` for use with `image2image`.
152
+ - Descriptions are posted as-is from original model source.
153
+ - Not all features and/or results may be available in `CoreML` format.
154
+ - This model does not have the [unet split into chunks](https://github.com/apple/ml-stable-diffusion#-converting-models-to-core-ml).
155
+ - This model does not include a `safety checker` (for NSFW content).
156
+ - This model can not be used with ControlNet.
157
+
158
+ # animagine-xl-3.0
159
+ Sources: [Hugging Face](https://huggingface.co/cagliostrolab/animagine-xl-3.0)
160
+
161
+ The remaining contents of this model card were copied from the original animagine-xl-3.0 repo
162
+
163
+ <h1 class="title">
164
+ <span>Animagine XL 3.0</span>
165
+ </h1>
166
+ <table class="custom-table">
167
+ <tr>
168
+ <td>
169
+ <div class="custom-image-container">
170
+ <img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/ep_oy_NVSMQaU162w8Gwp.png" alt="sample1">
171
+ </div>
172
+ <div class="custom-image-container">
173
+ <img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/FGFZgsqrhOcor5mid5eap.png" alt="sample4">
174
+ </div>
175
+ </td>
176
+ <td>
177
+ <div class="custom-image-container">
178
+ <img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/EuvINvBsCKZQuspZHN-uF.png" alt="sample2">
179
+ </div>
180
+ <div class="custom-image-container">
181
+ <img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/yyRqdHJfePKl7ytB6ieX9.png" alt="sample3">
182
+ </td>
183
+ <td>
184
+ <div class="custom-image-container">
185
+ <img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/2oWmFh728T0hzEkUtSmgy.png" alt="sample1">
186
+ </div>
187
+ <div class="custom-image-container">
188
+ <img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/3yaZxWkUOenZSSNtGQR_3.png" alt="sample4">
189
+ </div>
190
+ </td>
191
+ </tr>
192
+ </table>
193
+
194
+ **Animagine XL 3.0** is the latest version of the sophisticated open-source anime text-to-image model, building upon the capabilities of its predecessor, Animagine XL 2.0. Developed based on Stable Diffusion XL, this iteration boasts superior image generation with notable improvements in hand anatomy, efficient tag ordering, and enhanced knowledge about anime concepts. Unlike the previous iteration, we focused to make the model learn concepts rather than aesthetic.
195
+
196
+ ## Model Details
197
+ - **Developed by**: [Cagliostro Research Lab](https://huggingface.co/cagliostrolab)
198
+ - **Model type**: Diffusion-based text-to-image generative model
199
+ - **Model Description**: Animagine XL 3.0 is engineered to generate high-quality anime images from textual prompts. It features enhanced hand anatomy, better concept understanding, and prompt interpretation, making it the most advanced model in its series.
200
+ - **License**: [Fair AI Public License 1.0-SD](https://freedevproject.org/faipl-1.0-sd/)
201
+ - **Finetuned from model**: [Animagine XL 2.0](https://huggingface.co/Linaqruf/animagine-xl-2.0)
202
+
203
+ ## Gradio & Colab Integration
204
+
205
+ Animagine XL 3.0 is accessible through user-friendly platforms such as Gradio and Google Colab:
206
+
207
+ - **Gradio Web UI**: [Open In Spaces](https://huggingface.co/spaces/Linaqruf/Animagine-XL)
208
+ - **Google Colab**: [Open In Colab](https://colab.research.google.com/#fileId=https%3A//huggingface.co/Linaqruf/animagine-xl/blob/main/Animagine_XL_demo.ipynb)
209
+
210
+ ## 🧨 Diffusers Installation
211
+
212
+ To use Animagine XL 3.0, install the required libraries as follows:
213
+
214
+ ```bash
215
+ pip install diffusers --upgrade
216
+ pip install transformers accelerate safetensors
217
+ ```
218
+
219
+ Example script for generating images with Animagine XL 3.0:
220
+
221
+ ```python
222
+ import torch
223
+ from diffusers import (
224
+ StableDiffusionXLPipeline,
225
+ EulerAncestralDiscreteScheduler,
226
+ AutoencoderKL
227
+ )
228
+
229
+ # Load VAE component
230
+ vae = AutoencoderKL.from_pretrained(
231
+ "madebyollin/sdxl-vae-fp16-fix",
232
+ torch_dtype=torch.float16
233
+ )
234
+
235
+ # Configure the pipeline
236
+ pipe = StableDiffusionXLPipeline.from_pretrained(
237
+ "cagliostrolab/animagine-xl-3.0",
238
+ vae=vae,
239
+ torch_dtype=torch.float16,
240
+ use_safetensors=True,
241
+ variant="fp16"
242
+ )
243
+ pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
244
+ pipe.to('cuda')
245
+
246
+ # Define prompts and generate image
247
+ prompt = "1girl, arima kana, oshi no ko, solo, upper body, v, smile, looking at viewer, outdoors, night"
248
+ negative_prompt = "nsfw, 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, artist name"
249
+
250
+ image = pipe(
251
+ prompt,
252
+ negative_prompt=negative_prompt,
253
+ width=832,
254
+ height=1216,
255
+ guidance_scale=7,
256
+ num_inference_steps=28
257
+ ).images[0]
258
+ ```
259
+
260
+ ## Usage Guidelines
261
+
262
+ ### Tag Ordering
263
+
264
+ Prompting is a bit different in this iteration, for optimal results, it's recommended to follow the structured prompt template because we train the model like this:
265
+
266
+ ```
267
+ 1girl/1boy, character name, from what series, everything else in any order.
268
+ ```
269
+
270
+ ## Special Tags
271
+
272
+ Like the previous iteration, this model was trained with some special tags to steer the result toward quality, rating and when the posts was created. The model can still do the job without these special tags, but it’s recommended to use them if we want to make the model easier to handle.
273
+
274
+ ### Quality Modifiers
275
+
276
+ | Quality Modifier | Score Criterion |
277
+ | ---------------- | --------------- |
278
+ | `masterpiece` | >150 |
279
+ | `best quality` | 100-150 |
280
+ | `high quality` | 75-100 |
281
+ | `medium quality` | 25-75 |
282
+ | `normal quality` | 0-25 |
283
+ | `low quality` | -5-0 |
284
+ | `worst quality` | <-5 |
285
+
286
+ ### Rating Modifiers
287
+
288
+ | Rating Modifier | Rating Criterion |
289
+ | ------------------------------| ------------------------- |
290
+ | `rating: general` | General |
291
+ | `rating: sensitive` | Sensitive |
292
+ | `rating: questionable`, `nsfw`| Questionable |
293
+ | `rating: explicit`, `nsfw` | Explicit |
294
+
295
+ ### Year Modifier
296
+
297
+ These tags help to steer the result toward modern or vintage anime art styles, ranging from `newest` to `oldest`.
298
+
299
+ | Year Tag | Year Range |
300
+ | -------- | ---------------- |
301
+ | `newest` | 2022 to 2023 |
302
+ | `late` | 2019 to 2021 |
303
+ | `mid` | 2015 to 2018 |
304
+ | `early` | 2011 to 2014 |
305
+ | `oldest` | 2005 to 2010 |
306
+
307
+ ## Recommended settings
308
+
309
+ To guide the model towards generating high-aesthetic images, use negative prompts like:
310
+
311
+ ```
312
+ nsfw, 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, artist name
313
+ ```
314
+
315
+ For higher quality outcomes, prepend prompts with:
316
+
317
+ ```
318
+ masterpiece, best quality
319
+ ```
320
+
321
+ However, be careful to use `masterpiece`, `best quality` because many high-scored datasets are NSFW. It’s better to add `nsfw`, `rating: sensitive` to the negative prompt and `rating: general` to the positive prompt. it’s recommended to use a lower classifier-free guidance (CFG Scale) of around 5-7, sampling steps below 30, and to use Euler Ancestral (Euler a) as a sampler.
322
+
323
+ ### Multi Aspect Resolution
324
+
325
+ This model supports generating images at the following dimensions:
326
+
327
+ | Dimensions | Aspect Ratio |
328
+ |-------------------|-----------------|
329
+ | `1024 x 1024` | 1:1 Square |
330
+ | `1152 x 896` | 9:7 |
331
+ | `896 x 1152` | 7:9 |
332
+ | `1216 x 832` | 19:13 |
333
+ | `832 x 1216` | 13:19 |
334
+ | `1344 x 768` | 7:4 Horizontal |
335
+ | `768 x 1344` | 4:7 Vertical |
336
+ | `1536 x 640` | 12:5 Horizontal |
337
+ | `640 x 1536` | 5:12 Vertical |
338
+
339
+ ## Training and Hyperparameters
340
+
341
+ - **Animagine XL 3.0** was trained on a 2x A100 GPU with 80GB memory for 21 days or over 500 gpu hours. The training process encompassed three stages:
342
+ - Base:
343
+ - **Feature Alignment Stage**: Utilized 1.2m images to acquaint the model with basic anime concepts.
344
+ - **Refining UNet Stage**: Employed 2.5k curated datasets to only fine-tune the UNet.
345
+ - Curated:
346
+ - **Aesthetic Tuning Stage**: Employed 3.5k high-quality curated datasets to refine the model's art style.
347
+
348
+ ### Hyperparameters
349
+
350
+ | Stage | Epochs | UNet Learning Rate | Train Text Encoder | Text Encoder Learning Rate | Batch Size | Mixed Precision | Noise Offset |
351
+ |-----------------------------|--------|--------------------|--------------------|----------------------------|----------------|-----------------|--------------|
352
+ | **Feature Alignment Stage** | 10 | 7.5e-6 | True | 3.75e-6 | 48 x 2 | fp16 | N/A |
353
+ | **Refining UNet Stage** | 10 | 2e-6 | False | N/A | 48 | fp16 | 0.0357 |
354
+ | **Aesthetic Tuning Stage** | 10 | 1e-6 | False | N/A | 48 | fp16 | 0.0357 |
355
+
356
+ ## Model Comparison
357
+
358
+ ### Training Config
359
+
360
+ | Configuration Item | Animagine XL 2.0 | Animagine 3.0 |
361
+ |-----------------------|-------------------------|-------------------------|
362
+ | **GPU** | A100 80G | 2 x A100 80G |
363
+ | **Dataset** | 170k + 83k images | 1271990 + 3500 Images |
364
+ | **Shuffle Separator** | N/A | True |
365
+ | **Global Epochs** | 20 | 20 |
366
+ | **Learning Rate** | 1e-6 | 7.5e-6 |
367
+ | **Batch Size** | 32 | 48 x 2 |
368
+ | **Train Text Encoder**| True | True |
369
+ | **Train Special Tags**| True | True |
370
+ | **Image Resolution** | 1024 | 1024 |
371
+ | **Bucket Resolution** | 2048 x 512 | 2048 x 512 |
372
+
373
+ Source code and training config are available here: https://github.com/cagliostrolab/sd-scripts/tree/main/notebook
374
+
375
+ ## Limitations
376
+
377
+ While "Animagine XL 3.0" represents a significant advancement in anime text-to-image generation, it's important to acknowledge its limitations to understand its best use cases and potential areas for future improvement.
378
+
379
+ 1. **Concept Over Artstyle Focus**: The model prioritizes learning concepts rather than specific art styles, which might lead to variations in aesthetic appeal compared to its predecessor.
380
+ 2. **Non-Photorealistic Design**: Animagine XL 3.0 is not designed for generating photorealistic or realistic images, focusing instead on anime-style artwork.
381
+ 3. **Anatomical Challenges**: Despite improvements, the model can still struggle with complex anatomical structures, particularly in dynamic poses, resulting in occasional inaccuracies.
382
+ 4. **Dataset Limitations**: The training dataset of 1.2 million images may not encompass all anime characters or series, limiting the model's ability to generate less known or newer characters.
383
+ 5. **Natural Language Processing**: The model is not optimized for interpreting natural language, requiring more structured and specific prompts for best results.
384
+ 6. **NSFW Content Risk**: Using high-quality tags like 'masterpiece' or 'best quality' carries a risk of generating NSFW content inadvertently, due to the prevalence of such images in high-scoring training datasets.
385
+
386
+ These limitations highlight areas for potential refinement in future iterations and underscore the importance of careful prompt crafting for optimal results. Understanding these constraints can help users better navigate the model's capabilities and tailor their expectations accordingly.
387
+
388
+ ## Acknowledgements
389
+
390
+ We extend our gratitude to the entire team and community that contributed to the development of Animagine XL 3.0, including our partners and collaborators who provided resources and insights crucial for this iteration.
391
+
392
+ - **Main:** For the open source grant supporting our research, thank you so much.
393
+ - **Cagliostro Lab Collaborator:** For helping quality checking during pretraining and curating datasets during fine-tuning.
394
+ - **Kohya SS:** For providing the essential training script and merged our PR about `keep_tokens_separator` or Shuffle Separator.
395
+ - **Camenduru Server Community:** For invaluable insights and support and quality checking
396
+ - **NovelAI:** For inspiring how to build the datasets and label it using tag ordering.
397
+
398
+ ## Collaborators
399
+
400
+ - [Linaqruf](https://huggingface.co/Linaqruf)
401
+ - [DamarJati](https://huggingface.co/DamarJati)
402
+ - [Asahina2K](https://huggingface.co/Asahina2K)
403
+ - [ItsMeBell](https://huggingface.co/ItsMeBell)
404
+ - [Zwicky18](https://huggingface.co/Zwicky18)
405
+ - [NekoFi](https://huggingface.co/NekoFi)
406
+ - [Scipius2121](https://huggingface.co/Scipius2121)
407
+ - [Raelina](https://huggingface.co/Raelina)
408
+
409
+ ## License
410
+
411
+ Animagine XL 3.0 now uses the [Fair AI Public License 1.0-SD](https://freedevproject.org/faipl-1.0-sd/), compatible with Stable Diffusion models. Key points:
412
+ 1. **Modification Sharing:** If you modify Animagine XL 3.0, you must share both your changes and the original license.
413
+ 2. **Source Code Accessibility:** If your modified version is network-accessible, provide a way (like a download link) for others to get the source code. This applies to derived models too.
414
+ 3. **Distribution Terms:** Any distribution must be under this license or another with similar rules.
415
+ 4. **Compliance:** Non-compliance must be fixed within 30 days to avoid license termination, emphasizing transparency and adherence to open-source values.
416
+
417
+ The choice of this license aims to keep Animagine XL 3.0 open and modifiable, aligning with open source community spirit. It protects contributors and users, encouraging a collaborative, ethical open-source community. This ensures the model not only benefits from communal input but also respects open-source development freedoms.
sprit_einsum/1024x1024/animagine-xl-3.0_split-einsum_6bit_1024x1024.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b73fd645ddf70949027f34cae0e74fcd6d2dff1e6aec78dd832b56babe28c77
3
+ size 2818349764