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_b")

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

data266-lab2-p2-run_b: LoRA r=32 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 32 / 32
trainable parameters 6,377,472 (0.74% 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) 2.88 GiB
train time 29.2 min (0.487 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.0171
kid_all_std 0.0135 0.0079
kid_in_domain 0.0609 0.0062
kid_in_domain_std 0.0242 0.0082
clip_all 32.5165 32.1147
clip_in_domain 32.4205 31.2576
clip_out_of_domain 31.2865 31.5613
clip_compositional 33.9388 34.3822
lpips_diversity 0.7996 0.7800
lpips_in_domain 0.8070 0.7667
lpips_out_of_domain 0.7413 0.7663
lpips_compositional 0.8432 0.8202
gen_sec_per_image 4.3295 4.5333
trainable_params_M n/a 6.3775
train_gpu_hours n/a 0.4868
peak_mem_gib n/a 2.8755

Safety checks

  • Generated images flagged by the SD safety checker: 0 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.901; min LPIPS to nearest train image 0.673

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_b')
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
18
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

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

Adapter
(816)
this model

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