PEFT — the adapter library
You know the methods (Topics 22–23); PEFT is Hugging Face's implementation of them, and you've already called it (LoraConfig, get_peft_model). What completes the picture is its lifecycle API — the verbs of adapter management:
from peft import PeftModel
model = PeftModel.from_pretrained(base, "you/your-adapter") # attach
model.merge_and_unload() # Topic 23's merge
model.load_adapter("you/other-adapter", adapter_name="b") # wardrobe...
model.set_adapter("b") # ...switch outfitsAn adapter on disk is two tiny files — adapter_model.safetensors + adapter_config.json — which is why they're shareable, hot-swappable, and checkpoint-cheap (Topic 26's dividend). Beyond LoRA, the same LoraConfig carries the modern refinements as flags (use_dora=True for Topic 22's DoRA), and the library implements the rest of the family tree (IA³, prompt tuning) under one interface. One genuinely fun advanced verb: add_weighted_adapter — arithmetic between adapters, blending, say, 0.7 × your-style-adapter + 0.3 × json-adapter into a new one. Task vectors as a product feature.
Summary
The standard library turning Module 3's PEFT theory into a small, consistent API: configure, attach, switch, merge, blend.
Mental model
The wardrobe's management system — hangers, tags, and a tailor who can sew two outfits into one.
Mistakes to avoid
Merging when you didn't need to (you lose the swap/stack flexibility; merge only for deployment), and version drift — PEFT/transformers/TRL move fast together, so pin versions per project or enjoy mysterious breakage.
Exercise