File size: 6,045 Bytes
6a82b2e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2b164fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
---
license: openrail++
language:
- en
tags:
  - text-to-image
  - stable-diffusion
  - lora
  - safetensors
  - diffusers
  - stable-diffusion-xl
base_model: Linaqruf/animagine-xl
inference: 
  parameter:
    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
widget:
- text: >-
    face focus, cute, masterpiece, best quality, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck
  example_title: example 1girl
- text: >-
    face focus, bishounen, masterpiece, best quality, 1boy, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck
  example_title: example 1boy
datasets:
- Linaqruf/sdxl-dataset
---

<style>
  .title-container {
    display: flex;
    flex-direction: column; /* Allow vertical stacking of title and subtitle */
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f5f5f5;
  }
  
  .title {
    font-size: 2.5em;
    text-align: center;
    color: #333;
    font-family: 'Verdana', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    padding: 1em;
    border: 2px solid #7ed56f;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.1);
  }
  
  .title span, .subtitle span {
    background: -webkit-linear-gradient(45deg, #ff9a9e, #fad0c4, #f6d365);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  
  .subtitle {
    margin-top: 15px;
    font-size: 1em; 
    font-family: 'Verdana', sans-serif;
    color: #666;
    text-align: center; 
  }
  .custom-table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    margin-top: 2em;
  }
  .custom-table td {
    width: 50%;
    vertical-align: top;
    padding: 10px;
    box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.15);
  }
  .custom-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 10px;
    transition: transform .2s; 
    margin-bottom: 1em;
  }
  .custom-image:hover {
    transform: scale(1.05);
  }
</style>

<h1 class="title"><span>Pastel Anime LoRA for SDXL</span></h1>
<h2 class="subtitle"><span>TRAINED WITH </span><a href="https://huggingface.co/Linaqruf/animagine-xl"><span>ANIMAGINE XL</span></a></h2>

<hr>

<table class="custom-table">
  <tr>
    <td>
      <a href="https://huggingface.co/Linaqruf/pastel-anime-xl-lora/blob/main/samples/xl_output_upscaled_00001_.png">
        <img class="custom-image" src="https://huggingface.co/Linaqruf/pastel-anime-xl-lora/resolve/main/samples/xl_output_upscaled_00001_.png" alt="sample1">
      </a>
    </td>
    <td>
      <a href="https://huggingface.co/Linaqruf/pastel-anime-xl-lora/blob/main/samples/xl_output_upscaled_00006_.png">
        <img class="custom-image" src="https://huggingface.co/Linaqruf/pastel-anime-xl-lora/resolve/main/samples/xl_output_upscaled_00006_.png" alt="sample2">
      </a>
    </td>
  </tr>
</table>

<hr>

## Overview

**Pastel Anime LoRA for SDXL** is a high-resolution, Low-Rank Adaptation model for Stable Diffusion XL. The model has been fine-tuned using a learning rate of 1e-5 over 1300 global steps with a batch size of 24 on a curated dataset of superior-quality anime-style images. This model is derived from Animagine XL.

Like other anime-style Stable Diffusion models, it also supports Danbooru tags to generate images.

e.g. _**face focus, cute, masterpiece, best quality, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck**_


<hr>

## Model Details

- **Developed by:** [Linaqruf](https://github.com/Linaqruf)
- **Model type:** Low-rank adaptation of diffusion-based text-to-image generative model
- **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. 
- **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL)
- **Finetuned from model:** [Animagine XL](https://huggingface.co/Linaqruf/animagine-xl)

<hr>

## 🧨 Diffusers 

Make sure to upgrade diffusers to >= 0.18.2:
```
pip install diffusers --upgrade
```

In addition make sure to install `transformers`, `safetensors`, `accelerate` as well as the invisible watermark:
```
pip install invisible_watermark transformers accelerate safetensors
```

Running the pipeline (if you don't swap the scheduler it will run with the default **EulerDiscreteScheduler** in this example we are swapping it to **EulerAncestralDiscreteScheduler**:
```py
import torch
from torch import autocast
from diffusers import StableDiffusionXLPipeline, EulerAncestralDiscreteScheduler

base_model = "Linaqruf/animagine-xl"
lora_model_id = "Linaqruf/pastel-anime-xl-lora"
lora_filename = "pastel-anime-xl.safetensors"

pipe = StableDiffusionXLPipeline.from_pretrained(
    model, 
    torch_dtype=torch.float16, 
    use_safetensors=True, 
    variant="fp16"
    )

pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
pipe.to('cuda')

pipe.load_lora_weights(lora_model_id, weight_name=lora_filename)

prompt = "face focus, cute, masterpiece, best quality, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck"
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"

image = pipe(
    prompt, 
    negative_prompt=negative_prompt, 
    width=1024,
    height=1024,
    guidance_scale=12,
    target_size=(1024,1024),
    original_size=(4096,4096),
    num_inference_steps=50
    ).images[0]

image.save("anime_girl.png")
```
<hr>

## Limitation 
This model inherit Stable Diffusion XL 1.0 [limitation](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0#limitations)