Builder-Neekhil/photography-fundamentals-qwen3-4b
011
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
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
Usage (LoRA Adapter)
This repo contains the LoRA adapter. Load it on top of the base model:
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
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
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.
