CoolFace
Modelpublic

Builder-Neekhil/photography-fundamentals-qwen3-4b

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes11downloads
Model Card

Photography Fundamentals SLM (Qwen3-4B QLoRA)

A small language model fine-tuned specifically for photography education — covering composition, exposure, lighting, color theory, post-processing, and camera equipment.

Final Training Results

MetricValue
Best eval loss2.114
Best eval token accuracy53.6%
Final train loss1.94
Training epochs~2 of 3 (stopped early — eval loss plateaued)
Total training steps~2,200

Model Details

  • —Base Model: Qwen/Qwen3-4B — Apache 2.0
  • —Fine-tuning Method: QLoRA (4-bit NF4 quantization + LoRA r=64, all-linear)
  • —Training Data: 15,907 photography Q&A pairs from Photo Stack Exchange + curated synthetic examples
  • —Trainable Parameters: 132.1M / 2,337.9M (5.65%)
  • —Hardware: NVIDIA L4 (24GB VRAM)

What It Knows

TopicCoverage
Exposure TriangleAperture, shutter speed, ISO, metering, histograms
CompositionRule of thirds, leading lines, framing, negative space, golden ratio
LightingNatural light, studio lighting, flash, modifiers, portrait patterns
ColorWhite balance, color temperature, HSL, color grading, split toning
Post-ProcessingRAW development, Lightroom/Photoshop workflows, HDR, focus stacking
EquipmentLenses, camera bodies, filters, tripods, lighting gear
GenresPortrait, landscape, street, wildlife, macro, astrophotography

Usage (LoRA Adapter)

This repo contains the LoRA adapter. Load it on top of the base model:

python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
    "Qwen/Qwen3-4B",
    torch_dtype="auto",
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("Builder-Neekhil/photography-fundamentals-qwen3-4b")

# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "Builder-Neekhil/photography-fundamentals-qwen3-4b")

# Generate
messages = [
    {"role": "system", "content": "You are an expert photography instructor."},
    {"role": "user", "content": "How do I use the exposure triangle for sunset photography?"}
]

text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7, top_p=0.8)
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True))

Merge adapter for standalone deployment

python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B", torch_dtype="auto")
model = PeftModel.from_pretrained(base_model, "Builder-Neekhil/photography-fundamentals-qwen3-4b")
merged = model.merge_and_unload()
merged.save_pretrained("photography-slm-merged")
AutoTokenizer.from_pretrained("Builder-Neekhil/photography-fundamentals-qwen3-4b").save_pretrained("photography-slm-merged")

Training Config

ParameterValue
Learning rate2e-4 (cosine decay)
Warmup steps150
Effective batch size16 (2 × 8 grad accum)
Max sequence length2048
Weight decay0.01
LoRA rank (r)64
LoRA alpha32
LoRA dropout0.05
Target modulesall-linear (q,k,v,o,gate,up,down)
Quantization4-bit NF4, double quant
Early stoppingManual at epoch ~2 (eval loss plateau)

Dataset

Built from Photo Stack Exchange via HuggingFaceH4/stack-exchange-preferences (CC-BY-SA 4.0), filtered for photography topics with pm_score ≥ 1. Supplemented with curated synthetic examples.

Dataset: Builder-Neekhil/photography-fundamentals-sft (15,907 train / 838 test)

Limitations

  • —Text-only — cannot analyze actual photographs
  • —Knowledge reflects Stack Exchange community consensus
  • —May occasionally generate HTML artifacts from source data
  • —Best suited as a photography tutor/reference, not for creative writing

License

Apache 2.0 (inherited from Qwen3-4B). Training data under CC-BY-SA 4.0.