kentarrito/kanji_dataset
Viewer β’ Updated β’ 16.7k β’ 10
How to use kentarrito/stable-diffusion-2-kanji-finetune-lora with Diffusers:
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline
# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("kentarrito/stable-diffusion-2-kanji-finetune-lora", dtype=torch.bfloat16, device_map="cuda")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]kentarrito/stable-diffusion-2-kanji-finetune-lora
This model is a LoRA fine-tuned version of Stable Diffusion 2, trained to generate kanji-like images based on their English meanings.
LoRA tuning allows lightweight updates to the base model, making it easier to combine with other LoRA modules or revert to base SD2.0.
from diffusers import StableDiffusionPipeline, UNet2DConditionModel
import torch
from peft import PeftModel
base_model = "stabilityai/stable-diffusion-2"
lora_model = "kentarrito/stable-diffusion-2-kanji-finetune-lora"
pipe = StableDiffusionPipeline.from_pretrained(
base_model, torch_dtype=torch.float16
).to("cuda")
pipe.unet = PeftModel.from_pretrained(pipe.unet, lora_model)
image = pipe(prompt="peace").images[0]
image.show()
π§ If using the LoRA manually, merge the LoRA weights into the UNet before generation.
See Github
See kentarrito/kanji_dataset
Each image represents a kanji symbol and is paired with a corresponding English word.
stabilityai/stable-diffusion-2diffusers + peftMIT License. Dataset sources follow KanjiVG and KANJIDIC2 licenses.
Base model
stabilityai/stable-diffusion-2