Downloads · 30 days
304
3% of all-time downloads
Linaqruf/sketch-style-xl-lora
sketch-style-xl-lora is a text-to-image model from Linaqruf. Use it when you need an image from a text prompt. It is set up for diffusers. The card lists the license as openrail++.
<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; }
Downloads · 30 days
304
3% of all-time downloads
All-time downloads
10.7K
Public
Repo size
47.2 MB
Likes
16
Public
Click a slice to open those files.
.safetensors47.2 MB · 100%
From the Hugging Face model README
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>The Sketch Style XL LoRA model effectively interprets and generates images based on the following keywords:
Ensure the installation of the latest diffusers library, along with other essential packages:
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.
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")