Linaqruf's picture
Update README.md
2ac5832
---
library_name: diffusers
license: openrail++
language:
- en
tags:
- text-to-image
- stable-diffusion
- lora
- safetensors
- stable-diffusion-xl
base_model: Linaqruf/animagine-xl-2.0
widget:
- text: face focus, cute, masterpiece, best quality, sketch, monochrome, greyscale, 1girl, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck
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
example_title: 1girl
- text: face focus, bishounen, masterpiece, best quality, sketch, monochrome, greyscale, 1boy, green hair, sweater, looking at viewer, upper body, beanie, outdoors, night, turtleneck
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
example_title: 1boy
---
<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: 2em;
text-align: center;
color: #333;
font-family: 'Verdana', sans-serif;
text-transform: uppercase;
padding: 1em;
box-shadow: 0px 0px 0px rgba(0,0,0,0.1);
}
.title span {
background: -webkit-linear-gradient(45deg, #ff9a9e, #fad0c4, #f6d365);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.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 0px 0px rgba(0, 0, 0, 0.15);
}
.custom-image-container {
position: relative;
width: 100%;
margin-bottom: 0em;
overflow: hidden;
border-radius: 10px;
transition: transform .7s;
/* Smooth transition for the container */
}
.custom-image-container:hover {
transform: scale(1.05);
/* Scale the container on hover */
}
.custom-image {
width: 100%;
height: auto;
object-fit: cover;
border-radius: 10px;
transition: transform .7s;
margin-bottom: 0em;
}
.nsfw-filter {
filter: blur(8px); /* Apply a blur effect */
transition: filter 0.3s ease; /* Smooth transition for the blur effect */
}
.custom-image-container:hover .nsfw-filter {
filter: none; /* Remove the blur effect on hover */
}
</style>
<h1 class="title">
<span>Sketch Style XL LoRA</span>
</h1>
<table class="custom-table">
<tr>
<td>
<div class="custom-image-container">
<img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/Qk5o11rQao64WgvNeGfaa.png" alt="sample1">
</div>
<div class="custom-image-container">
<img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/m-nNVPiO5F4eGSW7O1Qw0.png" alt="sample4">
</div>
</td>
<td>
<div class="custom-image-container">
<img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/o-rlnIIq7tb2Vm9S1P3ze.png" alt="sample2">
</div>
<div class="custom-image-container">
<img class="custom-image" src="https://cdn-uploads.huggingface.co/production/uploads/6365c8dbf31ef76df4042821/JZO-cEZDr7ekNtkmV9-VA.png" alt="sample3">
</td>
</tr>
</table>
<hr>
## Overview
**Sketch Style XL LoRA** stands as an innovative, high-resolution LoRA adapter tailored for Animagine XL 2.0, focusing on sketch-style and monochromatic image generation. This model is adept at transforming text prompts into detailed sketches and grayscale images, capturing the essence of traditional media in digital form.
Notable supported tags for this model include _**monochrome, greyscale, sketch, traditional media**_ among others, facilitating a wide range of artistic expressions.
<hr>
## Model Details
- **Developed by:** [Linaqruf](https://github.com/Linaqruf)
- **Model type:** LoRA adapter for Stable Diffusion XL
- **Model Description:** Sketch Style XL LoRA is a specialized adapter designed to enhance Animagine XL 2.0's capability in creating sketch-like, monochromatic images. This model excels in interpreting text prompts to generate images that resemble hand-drawn sketches or traditional grayscale artworks. It is a versatile tool for artists and creators who seek to explore the interplay between text and sketch-style imagery.
- **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL)
- **Finetuned from model:** [Animagine XL 2.0](https://huggingface.co/Linaqruf/animagine-xl-2.0)
<hr>
## Usage
The Sketch Style XL LoRA model effectively interprets and generates images based on the following keywords:
- **Monochrome:** Generates images in shades of a single color, typically black and white.
- **Greyscale:** Produces images using varying shades of grey, simulating the look of classic black and white photography or artwork.
- **Sketch:** Creates images that resemble hand-drawn sketches, emphasizing outlines and shading without color.
- **Traditional Media:** Imitates the style of artwork created with traditional physical media like pencils, charcoal, or ink.
<hr>
## 🧨 Diffusers Installation
Ensure the installation of the latest `diffusers` library, along with other essential packages:
```bash
pip install diffusers --upgrade
pip install transformers accelerate safetensors
```
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.
```py
import torch
from diffusers import (
StableDiffusionXLPipeline,
EulerAncestralDiscreteScheduler,
AutoencoderKL
)
# Initialize LoRA model and weights
lora_model_id = "Linaqruf/sketch-style-xl-lora"
lora_filename = "sketch-style-xl.safetensors"
# Load VAE component
vae = AutoencoderKL.from_pretrained(
"madebyollin/sdxl-vae-fp16-fix",
torch_dtype=torch.float16
)
# Configure the pipeline
pipe = StableDiffusionXLPipeline.from_pretrained(
"Linaqruf/animagine-xl-2.0",
vae=vae,
torch_dtype=torch.float16,
use_safetensors=True,
variant="fp16"
)
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
pipe.to('cuda')
# Load and fuse LoRA weights
pipe.load_lora_weights(lora_model_id, weight_name=lora_filename)
pipe.fuse_lora(lora_scale=0.6)
# Define prompts and generate image
prompt = "face focus, cute, masterpiece, best quality, 1girl, sketch, monochrome, greyscale, 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,
num_inference_steps=50
).images[0]
# Unfuse LoRA before saving the image
pipe.unfuse_lora()
image.save("anime_girl.png")
```