|
--- |
|
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) |
|
|
|
|