RadarTopicsBuildersWeeklyReads
Open Source Radar
huggingface/

peft

GitHubWebsite

PEFT provides parameter-efficient fine-tuning methods for large models, with LoRA and other adapters, integrated into Transformers, Diffusers, and Accelerate. This review extracts facts from the README and releases to present concrete usage and project status.

22kstars
2.4kforks
59issues
Apache-2.0license
2022since
Star historydaily snapshots by VibeCrowd

Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).

Alternatives & relatedmatched by topic overlap
Reviewgenerated from repository data · Aug 5, 2026

What it is

PEFT enables efficient adaptation of large pretrained models by fine-tuning a small number of extra parameters, instead of all model parameters. It is integrated with Transformers, Diffusers, and Accelerate to support training and inference for large models.

How it works

PEFT offers multiple adapter-based methods (e.g., LoRA) to wrap a base model and apply a PEFT configuration. Example shows how to create a LoRA config with target modules and wrap a model using get_peft_model, then train and save the adapted model. The README includes code snippets demonstrating model preparation for training and loading a trained PEFT adapter for inference via PeftModel.

Getting started

Install PEFT from pip:

pip install peft

Prepare a model for training with a PEFT method such as LoRA by wrapping the base model and PEFT configuration with get_peft_model. Example uses bigscience/mt0-large and a LoRAConfig, then prints trainable parameters and saves the model:

import torch
from transformers import AutoModelForCausalLM
from peft import LoraConfig, TaskType, get_peft_model

device = torch.accelerator.current_accelerator().type if hasattr(torch, "accelerator") else "cuda"
model_id = "Qwen/Qwen2.5-3B-Instruct"
model = AutoModelForCausalLM.from_pretrained(model_id, device_map=device)
peft_config = LoraConfig(
    r=16,
    lora_alpha=32,
    task_type=TaskType.CAUSAL_LM,
    # target_modules=["q_proj", "v_proj", ...]  # optionally indicate target modules
)
model = get_peft_model(model, peft_config)
model.print_trainable_parameters()
# prints: trainable params: 3,686,400 || all params: 3,089,625,088 || trainable%: 0.1193

model.save_pretrained("qwen2.5-3b-lora")

To load a PEFT model for inference:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

device = torch.accelerator.current_accelerator().type if hasattr(torch, "accelerator") else "cuda"
model_id = "Qwen/Qwen2.5-3B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map=device)
model = PeftModel.from_pretrained(model, "qwen2.5-3b-lora")

inputs = tokenizer("Preheat the oven to 350 degrees and place the cookie dough", return_tensors="pt")
outputs = model.generate(**inputs.to(device), max_new_tokens=50)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Getting started (continued)

The repository describes compatibility with a range of PEFT methods and mentions a quickstart path through the provided code samples, including how to switch adapters with set_adapter in the Transformers integration. The Transformers integration notes that not all PEFT features are present in the adapter API (e.g., merging adapters into the base model).

Recent releases

Latest releases (ordered by date):

  • v0.20.0 (2026-07-28)
  • v0.19.1 (2026-04-16)
  • v0.19.0 (2026-04-14)
  • v0.18.1 (2026-01-09)
  • v0.18.0 (2025-11-13)

Traction

Stars: 21500

Behind the repo

Organization: HuggingFace. The repository is part of the HuggingFace ecosystem and integrates with Transformers, Diffusers, Accelerate. (No separate startup/company details provided beyond linked project and organization in the README excerpts.)

Caveats

License: Apache-2.0 Created: 2022-11-25 Last push: 2026-08-04 Open issues: 59 Language: Python Topics include adapter, diffusion, fine-tuning, llm, lora, parameter-efficient-learning, peft, python, pytorch, transformers.

SharePost on XLinkedIn
All trending reposRevenue-verified startups →