What do you want to do?
3 use cases
-
Fine-tune a small LLM with LoRA on one GPU
Wrap a base model with a LoRA config so you train only a tiny fraction of its parameters.
View prompt
Using huggingface/peft, fine-tune Qwen/Qwen2.5-3B-Instruct with LoRA (r=16, lora_alpha=32) on <dataset> using the Transformers Trainer. Print the trainable parameter count first, save the adapter, and report training loss.
-
Serve several task adapters from one base model
Save one small adapter per task and load or switch between them on a single base model.
View 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>.
-
Train a custom Stable Diffusion style with LoRA
Use PEFT LoRA with Diffusers to teach an image model a subject or style on a modest GPU.
View prompt
Using huggingface/peft, run examples/lora_dreambooth/train_dreambooth.py on CompVis/stable-diffusion-v1-4 with my images in <folder>, using LoRA and gradient checkpointing. Report peak GPU memory and save the adapter.
Quick start with Peft
- Check you have what it needs: 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.
- Open huggingface/peft on GitHub and read the README and license.
- Install with
pip install peft - Load a base model such as Qwen/Qwen2.5-3B-Instruct with Transformers
- Create a
LoraConfigwith r=16 and lora_alpha=32 for a causal LM and wrap the model withget_peft_model - Call
model.print_trainable_parameters()to confirm only about 0.12% of parameters are trainable
These steps come from our top use case, Fine-tune a small LLM with LoRA on one GPU, which also has a copy-paste agent prompt.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for huggingface/peft
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeAbout this repo
- Who it is forML engineers and hobbyists who want to adapt open models to their own data on a single GPU.
- Why it is hot22k stars, talked about in 2 AI sources we track
- LanguagePython
- Sourcegithub.com/huggingface/peft ยท Back to Hot repos
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
Add this badge to your README
Maintain Peft? Show readers where to find these use cases.
Markdown
[](https://dedupedai.com/use-cases/huggingface-peft/?utm_source=github&utm_medium=badge&utm_campaign=huggingface-peft)
HTML
<a href="https://dedupedai.com/use-cases/huggingface-peft/?utm_source=github&utm_medium=badge&utm_campaign=huggingface-peft"><img src="https://dedupedai.com/badge/huggingface/peft.svg" alt="Use cases on Deduped" height="20"></a>
A static image, no tracking script. About the badge
Questions about Peft
What is Peft?
PEFT is Hugging Face's library of parameter-efficient fine-tuning methods such as LoRA. Instead of training all of a model's weights, it trains a small adapter, often well under 1% of parameters, which cuts GPU memory and storage while keeping performance close to full fine-tuning. It integrates with Transformers, Diffusers, Accelerate and TRL, and combines with quantization for training on consumer GPUs. It is an open-source project on GitHub: https://github.com/huggingface/peft.
How do I use Peft?
Install with pip install peft; then load a base model such as Qwen/Qwen2.5-3B-Instruct with Transformers; create a LoraConfig with r=16 and lora_alpha=32 for a causal LM and wrap the model with get_peft_model. The use cases on this page give the full steps and a copy-paste agent prompt for each job.
Who is Peft for?
ML engineers and hobbyists who want to adapt open models to their own data on a single GPU.
What can I do with Peft?
3 use cases so far, for example: Fine-tune a small LLM with LoRA on one GPU; Serve several task adapters from one base model; Train a custom Stable Diffusion style with LoRA. Each has steps and a copy-paste agent prompt.
What do I need to run Peft?
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.
What are alternatives to Peft?
Other hot AI repos in Software and DevOps: ECC, Thinkrail, Superpowers, Deep Infer, Instructor.
Is Peft safe to run?
Deduped does not own, audit or vouch for it. Read the README and license, run it on your own systems first and review every command before you run it.