Configuration Parsing Warning:In adapter_config.json: "peft.base_model_name_or_path" must be a string

Configuration Parsing Warning:In adapter_config.json: "peft.task_type" must be a string

DATA 266 Lab 2, rank-4 LoRA

Pair_Programming_Team_03. This is a rank-4 LoRA on the UNet of Stable Diffusion 1.5, trained on Pokemon captions. It is for this course only.

Model details

  • Base model: stable-diffusion-v1-5/stable-diffusion-v1-5
  • Adapter: PEFT LoRA, rank 4, alpha 4, dropout 0
  • Target modules: to_q, to_k, to_v, to_out.0
  • Trainable parameters: 797,184
  • Developed by: Pair_Programming_Team_03 (Nikitha and Yash)

Training

  • Data: reach-vb/pokemon-blip-captions, 750 training rows
  • Optimizer: AdamW
  • Learning rate: 1e-4
  • Batch size: 1
  • Steps: 1,200
  • Seed: 266
  • Time: 268.1 seconds (0.0745 GPU-hours)
  • Peak GPU memory: 6.28 GB on an RTX 5080 Laptop (16 GB)

A 200-step probe of the same settings saw the loss rise from 0.0062 at step 0 to 0.3134 at step 100. A rank-16 run (3,188,736 parameters, 1,200 steps) and a rank-4 run at 4,000 steps both scored below this checkpoint on the held-out CLIP check, so this 1,200-step rank-4 adapter is the one we kept.

Results

Held-out CLIP, 10 captions, seed 0, 30 steps: base 0.3207, this adapter 0.3254 (+0.0047), rank 16 0.3172, rank 4 at 4,000 steps 0.3191. None of the runs cleared a 0.01 gain.

On the later 120-image set (20 prompts, seeds 0 and 1), after the adapter was actually loaded: this run scored CLIP 0.3109, LPIPS 0.7348, KID 0.0707, NSFW 0. The base model scored CLIP 0.3088, LPIPS 0.7569, KID 0.0868, NSFW 1.

Three people compared 25 shuffled pairs of this adapter against the base model. This adapter won 45 of 75 prompt-match votes (60%) and 39 of 75 Pokemon-style votes (52%).

How to use

Generation settings used in the lab: 30 steps, guidance 7.5, 512 pixels.

import torch
from diffusers import StableDiffusionPipeline
from peft import PeftModel

pipe = StableDiffusionPipeline.from_pretrained(
    "stable-diffusion-v1-5/stable-diffusion-v1-5",
    torch_dtype=torch.float16,
)
pipe.unet = PeftModel.from_pretrained(pipe.unet, "Nikithasb/data266-lab2-team03-lora-rank4")
pipe = pipe.to("cuda")
image = pipe("a red fish with a gold crown on its head", num_inference_steps=30, guidance_scale=7.5).images[0]

Limitations and license

Pokemon and Naruto characters in the training captions are copyrighted. These weights are for non-commercial course use only. The closest training neighbor of a generated image reached a CLIP similarity of 0.903, a generated Pikachu next to a training Pikachu, with a different pose and background.

The default Stable Diffusion safety checker is the NSFW filter. It flagged one base image and one rank-16 image on our prompt list, and none from this checkpoint. That is one prompt list, not a safety guarantee.

The adapter does not follow out-of-domain prompts more faithfully than the base model in any large way. The CLIP gap versus the base model is under 0.01.

Downloads last month
5
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for Nikithasb/data266-lab2-team03-lora-rank4

Adapter
(819)
this model