{
 "schema_version": 1,
 "generated": "2026-10-31",
 "id": "huggingface-peft--swap-task-adapters-on-one-base-model",
 "repo": "huggingface/peft",
 "repo_url": "https://github.com/huggingface/peft",
 "repo_slug": "huggingface-peft",
 "title": "Serve several task adapters from one base model",
 "page_title": "How to serve several task adapters from one base model with Peft",
 "summary": "Save one small adapter per task and load or switch between them on a single base model.",
 "who": "A team with separate fine-tunes for support replies, summaries and tagging who cannot host three full models.",
 "problem": "Keeping a full copy of a model for every task wastes storage and GPU memory.",
 "outcome": "One base model in memory with small adapters you load and switch per request.",
 "steps": [
  "Load a trained adapter for inference with `PeftModel.from_pretrained` on top of the base model",
  "With a Transformers model, add adapters with `add_adapter` and load trained ones with `load_adapter`",
  "Switch between them with `set_adapter`, for example to lora_2",
  "Keep each adapter as its own small checkpoint per task or dataset"
 ],
 "agent_prompt": "Using huggingface/peft, load base model <model> once and attach adapters <adapter A> and <adapter B> with load_adapter. Write a function that switches adapters with set_adapter per request and test each on <prompt>.",
 "agents": [
  "claude-code",
  "codex",
  "cursor"
 ],
 "difficulty": "Intermediate",
 "time": "45 minutes",
 "basis": "readme",
 "caveat": "The Transformers integration does not include every PEFT feature, such as merging the adapter into the base model.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "Python with PyTorch and Transformers",
  "A GPU with enough memory for the base model (the README shows a 3B model on far less memory with LoRA)",
  "A dataset for your task"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/huggingface-peft/swap-task-adapters-on-one-base-model/",
 "md": "https://dedupedai.com/use-cases/huggingface-peft/swap-task-adapters-on-one-base-model/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/huggingface-peft--swap-task-adapters-on-one-base-model.json",
 "api_version": "v1"
}
