Downloads · 30 days
0
TfiyuenLau/GirlsFrontline2_SDXL_LoRA
GirlsFrontline2_SDXL_LoRA is a text-to-image model from TfiyuenLau. Use it when you need an image from a text prompt. The card lists the license as apache-2.0.
Downloads · 30 days
0
Access
Public
Updated Feb 14, 2024
Repo size
765 MB
Likes
3
Public
Click a slice to open those files.
.0714 MB · 72%
From the Hugging Face model README

pip install diffusers --upgrade
pip install transformers accelerate safetensors
import torch
import datetime
from PIL import Image
import matplotlib.pyplot as plt
from diffusers import (
StableDiffusionXLPipeline,
EulerAncestralDiscreteScheduler,
AutoencoderKL
)
# LoRA Hugging Face ID
lora_id = "TfiyuenLau/GirlsFrontline2_SDXL_LoRA"
# Load VAE component
vae = AutoencoderKL.from_pretrained(
"madebyollin/sdxl-vae-fp16-fix",
torch_dtype=torch.float16
)
# Configure the pipeline
pipe = StableDiffusionXLPipeline.from_pretrained(
"cagliostrolab/animagine-xl-3.0",
vae=vae,
torch_dtype=torch.float16,
use_safetensors=True,
)
pipe.load_lora_weights(lora_id)
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
pipe.to('cuda')
# Define Prompt
output = "./output.png"
prompt = "1girl, OTs14, gloves, looking at viewer, smile, food, holding, solo, closed mouth, sitting, yellow eyes, black gloves, masterpiece, best quality"
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"
# Generate Image
image = pipe(
prompt,
negative_prompt=negative_prompt,
width=1024,
height=1024,
guidance_scale=7,
num_inference_steps=28
).images[0]
# Save & Show
image.save(output)
image = Image.open(output)
plt.axis('off')
plt.imshow(image)
image.close()