Downloads · 30 days
1.1K
22% of all-time downloads
ming-yang/sdxl_chinese_ink_lora
sdxl_chinese_ink_lora is a text-to-image model from ming-yang. Use it when you need an image from a text prompt. It is set up for diffusers. The card lists the license as creativeml-openrail-m.
Downloads · 30 days
1.1K
22% of all-time downloads
All-time downloads
4.9K
Public
Repo size
76.2 MB
Likes
15
Public
Click a slice to open those files.
.safetensors57.4 MB · 75%
From the Hugging Face model README
The Stable Diffusion XL model is finetuned on comtemporatory Chinese ink paintings.
Our inference process is speed up using LCM-LORA, please make sure all the necessary libraries are up to date.
pip install --upgrade pip
pip install --upgrade diffusers transformers accelerate peft
pip install matplotlib
Here, we should load two adapters, LCM-LORA for sample accleration and Chinese_Ink_LORA for styled rendering with it's base model stabilityai/stable-diffusion-xl-base-1.0. Next, the scheduler needs to be changed to LCMScheduler and we can reduce the number of inference steps to just 2 to 8 steps(8 used in my experiment).
import torch
from diffusers import DiffusionPipeline, LCMScheduler
import matplotlib.pyplot as plt
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0",
variant="fp16",
torch_dtype=torch.float16
).to("cuda")
# set scheduler
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
# load LoRAs
pipe.load_lora_weights("latent-consistency/lcm-lora-sdxl", adapter_name="lcm")
pipe.load_lora_weights("ming-yang/sdxl_chinese_ink_lora", adapter_name="Chinese Ink")
# Combine LoRAs
pipe.set_adapters(["lcm", "Chinese Ink"], adapter_weights=[1.0, 0.8])
prompts = ["Chinese Ink, mona lisa picture, 8k", "mona lisa, 8k"]
generator = torch.manual_seed(1)
images = [pipe(prompt, num_inference_steps=8, guidance_scale=1, generator=generator).images[0] for prompt in prompts]
fig, axs = plt.subplots(1, 2, figsize=(40, 20))
axs[0].imshow(images[0])
axs[0].axis('off') # 不显示坐标轴
axs[1].imshow(images[1])
axs[1].axis('off')
plt.show()
You should use Chinese Ink to trigger the image generation.
Weights for this model are available in Safetensors format.
Download them in the Files & versions tab.