Registry / llm-agents / adapters

adapters

JSON →
library1.3.0pypypiunverified

A unified library for parameter-efficient and modular transfer learning, supporting adapter methods like LoRA, Bottleneck Adapters, AdapterPlus, DoRA, and ReFT. Built on Hugging Face Transformers. Current version: 1.3.0. Release cadence: irregular, roughly every 2-3 months.

pip install adapters
INSTALL
IMPORT
SIG · ADAPTERS
A
adapters
llm-agentspythonv1.3.0
Install
12.8s avg
Import
Disk
251MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 248.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 12.8s · import 0.000s · 227MB
251MB installed
● package 251MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AutoAdapterModel
from adapters import AutoAdapterModel
from adapters import AutoAdapterModel

Load a BERT model, add a LoRA adapter, and run a forward pass.

from transformers import AutoTokenizer from adapters import AutoAdapterModel, LoRAConfig tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased") model = AutoAdapterModel.from_pretrained("bert-base-uncased") # Add a LoRA adapter with configuration config = LoRAConfig(r=8, alpha=16) model.add_adapter("my_lora_adapter", config=config) model.train_adapter("my_lora_adapter") # Example: encode a sentence inputs = tokenizer("Hello, adapters!", return_tensors="pt") outputs = model(**inputs) print(outputs.last_hidden_state.shape)
Debug
Known issues
breakingEach version of adapters supports a specific range of transformers versions. Using an incompatible transformers version may cause import errors or silent misbehavior. Check the release notes for the supported transformers version.
fix
Pin transformers to the version listed in the adapters release (e.g., for adapters 1.3.0 use transformers >=4.51.0, <4.58.0).
affects: all
gotchaWhen using QLoRA with bnb (bitsandbytes), the quantized model must be loaded with `load_in_4bit=True` and `torch_dtype=torch.bfloat16`. Omitting these may cause runtime errors or incorrect behavior.
fix
Use `model = AutoAdapterModel.from_pretrained(..., load_in_4bit=True, torch_dtype=torch.bfloat16)` and ensure bitsandbytes is installed.
affects: >=0.2.0
gotchaThe `adapter_to()` method is used to move adapter weights to a device and optionally convert dtype. Forgetting to call it after adding an adapter can leave weights on CPU, causing issues when training on GPU.
fix
After adding an adapter, call `model.adapter_to('cuda')` or `model.adapter_to('cuda', dtype=torch.float16)`.
affects: >=0.2.1
Upgrade
Version history
1.3.0latest on PyPI · released Apr 26, 2026
Audit
Dependencies
transformersrequiredCore dependency; adapters is built on top of HF Transformers
Agent activity
58 hits · last 30 days
node
48
Anthropic
1
Perplexity
1
OpenAI (training)
1
Resources
adapters — pip install adapters · libregistry