Text-to-Image
Diffusers
stable-diffusion
lora
How to use from the
Use from the
Diffusers library
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline

# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", dtype=torch.bfloat16, device_map="cuda")
pipe.load_lora_weights("muhammadfsalman/data266-lab2-p2-run_a")

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]

data266-lab2-p2-run_a: LoRA r=4 on naruto-blip-captions

LoRA adapter for Stable Diffusion 1.5, trained for DATA 266 (Fall 2026) Lab 2, Part 2. A second adapter with a different rank was trained with identical data, steps, LR and seed for comparison.

Training data

  • Dataset: lambdalabs/naruto-blip-captions; license on the dataset card: not declared (check terms before any reuse).
  • After cleaning: 861 train / 96 test images, 512x512 (center crop), split seed 266.
  • Removed: 0 corrupted/invalid, 0 exact duplicates, 0 near-duplicates (pHash <= 2), 264 flagged by the SD safety checker.

Training procedure

item value
method LoRA on UNet attention (to_q, to_k, to_v, to_out.0)
rank / alpha 4 / 4
trainable parameters 797,184 (0.09% of UNet)
learning rate / schedule 0.0001 / cosine, 50 warm-up steps
steps x batch 1500 x 4 (7.0 epochs)
precision fp16 autocast, LoRA weights fp32, gradient checkpointing True
hardware Tesla T4
peak GPU memory (allocated) 4.60 GiB
train time 30.4 min (0.507 GPU-hours)
seed 266

Evaluation (20 fixed prompts x seeds 0,1; computed in the training notebook)

metric base SD1.5 this model
kid_all 0.0623 0.0240
kid_all_std 0.0135 0.0096
kid_in_domain 0.0609 0.0119
kid_in_domain_std 0.0242 0.0090
clip_all 32.5165 31.8843
clip_in_domain 32.4205 31.3125
clip_out_of_domain 31.2865 31.5849
clip_compositional 33.9388 33.3274
lpips_diversity 0.7996 0.7892
lpips_in_domain 0.8070 0.7880
lpips_out_of_domain 0.7413 0.7430
lpips_compositional 0.8432 0.8379
gen_sec_per_image 4.3295 4.5364
trainable_params_M n/a 0.7972
train_gpu_hours n/a 0.5068
peak_mem_gib n/a 4.5952

Safety checks

  • Generated images flagged by the SD safety checker: 1 of 40.
  • Memorization check: 0 of 40 generated images have nearest-train CLIP cosine >= 0.966 (99th pct of held-out test images); max 0.906; min LPIPS to nearest train image 0.708

Usage

import torch
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained('stable-diffusion-v1-5/stable-diffusion-v1-5', torch_dtype=torch.float16).to('cuda')
pipe.load_lora_weights('muhammadfsalman/data266-lab2-p2-run_a')
image = pipe('a cartoon character with blue hair and a sword').images[0]

Intended use and limitations

  • Course project / research on parameter-efficient fine-tuning; not for production use.
  • Trained on a small stylised dataset of copyrighted fan material: outputs imitate that style and may resemble source characters.
  • Out-of-domain prompts can pick up the training style (style bleed); compositional prompts (counts, attribute binding) remain unreliable.
  • Inherits all limitations and the CreativeML OpenRAIL-M license of Stable Diffusion 1.5.
Downloads last month
3
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for muhammadfsalman/data266-lab2-p2-run_a

Adapter
(816)
this model

Dataset used to train muhammadfsalman/data266-lab2-p2-run_a