"__init__() got an unexpected keyword argument": the PEFT, TRL or Transformers release each argument needs
"X.__init__() got an unexpected keyword argument 'y'" means the installed library does not have y on that class: it is older than the release that added it, or newer than the release that removed it. For a LoRA adapter the cause is almost always an older PEFT: use_rslora needs PEFT 0.8.0, use_dora 0.9.0, layer_replication 0.10.0, lora_bias 0.14.0. For training scripts it is usually a removed name: evaluation_strategy is gone after Transformers 4.50.3 (write eval_strategy), and TRL's SFTTrainer stopped taking dataset_text_field and max_seq_length after TRL 0.12.2. Paste the error or the adapter's config below.
Which release has this argument?
Paste a TypeError line, the contents of adapter_config.json, or a call such as SFTConfig(max_seq_length=512). Versions are optional; with them you get a yes or no for your install.
Runs in your browser; nothing is sent anywhere. Versions: pip show peft transformers trl. The lookup knows 59 PEFT config classes, 85 TRL config and trainer classes, and Transformers TrainingArguments, Seq2SeqTrainingArguments, Trainer and Seq2SeqTrainer.
What do the most common of these errors mean?
| Error names | Cause | Fix |
|---|---|---|
LoraConfig 'use_dora' | The installed PEFT is older than 0.9.0. Usually the adapter was saved with a newer PEFT; the same error appears when your own code passes the option. | pip install -U "peft>=0.9.0" |
LoraConfig 'use_rslora' | The installed PEFT is older than 0.8.0. Usually the adapter was saved with a newer PEFT; the same error appears when your own code passes the option. | pip install -U "peft>=0.8.0" |
LoraConfig 'layer_replication' | The installed PEFT is older than 0.10.0. Usually the adapter was saved with a newer PEFT; the same error appears when your own code passes the option. | pip install -U "peft>=0.10.0" |
LoraConfig 'loftq_config' | The installed PEFT is older than 0.7.0. Usually the adapter was saved with a newer PEFT; the same error appears when your own code passes the option. | pip install -U "peft>=0.7.0" |
LoraConfig 'lora_bias', 'eva_config', 'exclude_modules' | The installed PEFT is older than 0.14.0. Usually the adapter was saved with a newer PEFT; the same error appears when your own code passes the option. | pip install -U "peft>=0.14.0" |
LoraConfig 'corda_config', 'trainable_token_indices' | The installed PEFT is older than 0.15.0. Usually the adapter was saved with a newer PEFT; the same error appears when your own code passes the option. | pip install -U "peft>=0.15.0" |
LoraConfig 'alora_invocation_tokens', 'arrow_config', 'ensure_weight_tying' | The installed PEFT is older than 0.18.0. Usually the adapter was saved with a newer PEFT; the same error appears when your own code passes the option. | pip install -U "peft>=0.18.0" |
TrainingArguments 'evaluation_strategy' | Removed from Transformers in 4.51.0 (last accepted in 4.50.3). | Write eval_strategy (from 4.41.0). |
TrainingArguments 'eval_strategy' | The installed Transformers is older than 4.41.0. | Upgrade Transformers, or write evaluation_strategy on that old release. |
SFTTrainer 'tokenizer' | Renamed in TRL 0.12.0; the old name was a warned alias until 0.15.2 and is rejected from 0.16.0. | Write processing_class. |
SFTTrainer 'dataset_text_field', 'max_seq_length', 'packing' | No longer trainer arguments from TRL 0.13.0 (last accepted in 0.12.2). | Set them on SFTConfig and pass it as args. |
SFTConfig 'max_seq_length' | Removed from TRL in 0.20.0 (last accepted in 0.19.1). | Write max_length (from 0.16.0). |
Trainer 'tokenizer' | Renamed in Transformers 4.46.0; a warned alias until 4.57.6, rejected from 5.0.0. | Write processing_class. |
Which PEFT release does each adapter_config.json key need?
A LoRA adapter loads without loss on any PEFT at or above the first release of its newest key. The table has every key LoraConfig has accepted (its own fields and those of its base classes), newest first; 42 are current in 0.21.3.
| Key | First PEFT release | Status in 0.21.3 |
|---|---|---|
kasa_config | 0.21.0 2026-09-15 | current |
monteclora_config | 0.20.0 2026-07-28 | current |
velora_config | 0.20.0 2026-07-28 | current |
lora_ga_config | 0.19.0 2026-04-14 | current |
use_bdlora | 0.19.0 2026-04-14 | current |
alora_invocation_tokens | 0.18.0 2025-11-13 | current |
arrow_config | 0.18.0 2025-11-13 | current |
ensure_weight_tying | 0.18.0 2025-11-13 | current |
peft_version | 0.18.0 2025-11-13 | current |
target_parameters | 0.17.0 2025-08-01 | current |
qalora_group_size | 0.16.0 2025-07-03 | current |
use_qalora | 0.16.0 2025-07-03 | current |
corda_config | 0.15.0 2025-03-19 | current |
trainable_token_indices | 0.15.0 2025-03-19 | current |
eva_config | 0.14.0 2024-12-06 | current |
exclude_modules | 0.14.0 2024-12-06 | current |
lora_bias | 0.14.0 2024-12-06 | current |
runtime_config | 0.12.0 2024-07-24 | current |
layer_replication | 0.10.0 2024-03-21 | current |
use_dora | 0.9.0 2024-02-28 | current |
use_rslora | 0.8.0 2024-01-30 | current |
loftq_config | 0.7.0 2023-12-06 | current |
megatron_config | 0.7.0 2023-12-06 | current |
megatron_core | 0.7.0 2023-12-06 | current |
alpha_pattern | 0.6.0 2023-11-02 | current |
rank_pattern | 0.6.0 2023-11-02 | current |
auto_mapping | 0.4.0 2023-07-17 | current |
layers_pattern | 0.4.0 2023-07-17 | current |
layers_to_transform | 0.4.0 2023-07-17 | current |
revision | 0.4.0 2023-07-17 | current |
init_lora_weights | 0.3.0 2023-05-04 | current |
base_model_name_or_path | 0.1.0 2023-02-10 | current |
modules_to_save | 0.1.0 2023-02-10 | current |
bias | 0.0.1 or earlier 2023-01-19 | current |
enable_lora | 0.0.1 or earlier 2023-01-19 | removed after 0.2.0 |
fan_in_fan_out | 0.0.1 or earlier 2023-01-19 | current |
inference_mode | 0.0.1 or earlier 2023-01-19 | current |
lora_alpha | 0.0.1 or earlier 2023-01-19 | current |
lora_dropout | 0.0.1 or earlier 2023-01-19 | current |
merge_weights | 0.0.1 or earlier 2023-01-19 | removed after 0.2.0 |
peft_type | 0.0.1 or earlier 2023-01-19 | current |
r | 0.0.1 or earlier 2023-01-19 | current |
target_modules | 0.0.1 or earlier 2023-01-19 | current |
task_type | 0.0.1 or earlier 2023-01-19 | current |
From PEFT 0.18.0 the file also records the saving version in peft_version. The other 58 config classes (AdaLoRA, IA3, LoHa, LoKr, VeRA, OFT, prompt tuning and the rest) are in the lookup above but not in this table.
Why does the same adapter raise TypeError on one machine and only a warning on another?
PEFT changed what it does with unknown keys in 0.14.0. Up to 0.13.2, loading a config with a key the installed PEFT does not know fails with TypeError: LoraConfig.__init__() got an unexpected keyword argument. From 0.14.0 the loader catches that error, removes the unknown keys and continues with a warning. PEFT 0.14.0 loading an adapter saved with 0.15.0 prints:
UserWarning: Unexpected keyword arguments ['corda_config', 'trainable_token_indices'] for class LoraConfig, these are ignored. This probably means that you're loading a configuration file that was saved using a higher version of the library and additional parameters have been introduced since. It is highly recommended to upgrade the PEFT version before continuing (e.g. by running `pip install -U peft`).
The warning is easy to miss, and the adapter then runs without the dropped settings. That is harmless when every dropped key held its default and wrong when one did not, for example a config saved with a newer variant switched on. Constructing a config in your own code, LoraConfig(use_dora=True), still raises TypeError on every release that lacks the argument; only loading from a file is lenient.
- Fix that always works: upgrade PEFT to the release in the table, or newer.
- Deleting the key by hand is the same as what 0.14.0 and later do automatically. PEFT's own troubleshooting page allows it only when the key is at its default value.
- A key that was removed (
enable_lora,merge_weights, last in 0.2.0) means the opposite direction: a very old adapter on a new PEFT.
Which TrainingArguments and Trainer arguments were removed from Transformers?
Transformers 5.0.0 removed most long-deprecated TrainingArguments names at once; a few went earlier or later. evaluation_strategy was last accepted in 4.50.3. Trainer(tokenizer=...) became processing_class in 4.46.0, stayed as a warned alias until 4.57.6 and is rejected from 5.0.0.
| TrainingArguments argument | From | Last release | Gone in | What to use |
|---|---|---|---|---|
model_parallel | v4.1.0 | v4.1.1 | v4.2.0 | – |
xpu_backend | v4.11.0 | v4.31.0 | v4.32.0 | – |
sharded_ddp | v4.1.0 | v4.34.1 | v4.35.0 | – |
dispatch_batches | v4.32.0 | v4.50.3 | v4.51.0 | Pass it inside accelerator_config, e.g. accelerator_config={"split_batches": True} (from v4.38.0). |
evaluation_strategy | v4.0.0 | v4.50.3 | v4.51.0 | Rename it to eval_strategy (from v4.41.0). |
split_batches | v4.35.0 | v4.50.3 | v4.51.0 | Pass it inside accelerator_config, e.g. accelerator_config={"split_batches": True} (from v4.38.0). |
tp_size | v4.50.0 | v4.51.3 | v4.52.0 | – |
use_ipex | v4.20.0 | v4.56.2 | v4.57.0 | – |
adafactor | v4.2.0 | v4.57.6 | v5.0.0 | Use optim="adafactor" (optim from v4.16.0). |
fp16_backend | v4.1.0 | v4.57.6 | v5.0.0 | fp16_backend was first renamed to half_precision_backend (v4.13.0); v5.0.0 removed both. Delete it. |
fp16_opt_level | v4.0.0 | v4.57.6 | v5.0.0 | – |
fsdp_min_num_params | v4.19.0 | v4.57.6 | v5.0.0 | Put it in fsdp_config (from v4.27.0). |
fsdp_transformer_layer_cls_to_wrap | v4.21.0 | v4.57.6 | v5.0.0 | Put it in fsdp_config (from v4.27.0). |
half_precision_backend | v4.13.0 | v4.57.6 | v5.0.0 | fp16_backend was first renamed to half_precision_backend (v4.13.0); v5.0.0 removed both. Delete it. |
include_inputs_for_metrics | v4.19.0 | v4.57.6 | v5.0.0 | Use include_for_metrics=["inputs"] (from v4.46.0). |
include_tokens_per_second | v4.34.0 | v4.57.6 | v5.0.0 | – |
jit_mode_eval | v4.20.0 | v4.57.6 | v5.0.0 | – |
mp_parameters | v4.5.0 | v4.57.6 | v5.0.0 | – |
no_cuda | v4.0.0 | v4.57.6 | v5.0.0 | Use use_cpu (from v4.32.0). |
overwrite_output_dir | v4.0.0 | v4.57.6 | v5.0.0 | – |
past_index | v4.0.0 | v4.57.6 | v5.0.0 | – |
per_gpu_eval_batch_size | v4.0.0 | v4.57.6 | v5.0.0 | Use per_device_train_batch_size / per_device_eval_batch_size. |
per_gpu_train_batch_size | v4.0.0 | v4.57.6 | v5.0.0 | Use per_device_train_batch_size / per_device_eval_batch_size. |
push_to_hub_model_id | v4.8.0 | v4.57.6 | v5.0.0 | Use hub_model_id with the full repository name (from v4.11.0). |
push_to_hub_organization | v4.8.0 | v4.57.6 | v5.0.0 | Use hub_model_id with the full repository name (from v4.11.0). |
push_to_hub_token | v4.8.0 | v4.57.6 | v5.0.0 | Use hub_token (from v4.11.0). |
ray_scope | v4.20.0 | v4.57.6 | v5.0.0 | – |
save_safetensors | v4.28.0 | v4.57.6 | v5.0.0 | – |
torchdynamo | v4.20.0 | v4.57.6 | v5.0.0 | Use torch_compile_backend (from v4.26.0). |
tpu_metrics_debug | v4.0.0 | v4.57.6 | v5.0.0 | – |
tpu_num_cores | v4.0.0 | v4.57.6 | v5.0.0 | – |
use_legacy_prediction_loop | v4.6.0 | v4.57.6 | v5.0.0 | – |
use_mps_device | v4.22.0 | v4.57.6 | v5.0.0 | Delete it; the mps device is used automatically when available. |
group_by_length | v4.3.0 | v5.1.0 | v5.2.0 | Use train_sampling_strategy="group_by_length" (from v5.2.0). |
logging_dir | v4.0.0 | v5.14.1 | v5.15.0 | Set the environment variable TENSORBOARD_LOGGING_DIR instead. |
warmup_ratio | v4.4.0 | v5.14.1 | v5.15.0 | Use warmup_steps with a float below 1, which is read as a ratio of the total steps. |
Trainer tokenizer | v4.0.0 | v4.45.2 (alias until v4.57.6) | v5.0.0 | Use processing_class (from v4.46.0). |
"From" v4.0.0 means v4.0.0 or earlier; older releases were not read. Seq2SeqTrainingArguments inherits all of these.
Which SFTTrainer, SFTConfig and DPOConfig arguments did TRL remove?
TRL 0.13.0 removed the dataset and length arguments from the trainers; they are set on the config classes (which exist from 0.9.3), and several were renamed there later. An old fine-tuning script can therefore fail three times in a row on a current release: on tokenizer, then dataset_text_field, then max_seq_length.
| Argument | From | Last release | Gone in | What to use |
|---|---|---|---|---|
SFTTrainer chars_per_token | v0.4.2 | v0.12.2 | v0.13.0 | – |
SFTTrainer dataset_batch_size | v0.5.0 | v0.12.2 | v0.13.0 | It is no longer a trainer argument. Set it on SFTConfig and pass that as args (SFTConfig exists from v0.9.3). |
SFTTrainer dataset_kwargs | v0.7.5 | v0.12.2 | v0.13.0 | It is no longer a trainer argument. Set it on SFTConfig and pass that as args (SFTConfig exists from v0.9.3). |
SFTTrainer dataset_num_proc | v0.5.0 | v0.12.2 | v0.13.0 | It is no longer a trainer argument. Set it on SFTConfig and pass that as args (SFTConfig exists from v0.9.3). |
SFTTrainer dataset_text_field | v0.4.2 | v0.12.2 | v0.13.0 | It is no longer a trainer argument. Set it on SFTConfig and pass that as args (SFTConfig exists from v0.9.3). |
SFTTrainer eval_packing | v0.8.0 | v0.12.2 | v0.13.0 | It is no longer a trainer argument. Set it on SFTConfig and pass that as args (SFTConfig exists from v0.9.3). |
SFTTrainer infinite | v0.4.2 | v0.12.2 | v0.13.0 | – |
SFTTrainer max_seq_length | v0.4.2 | v0.12.2 | v0.13.0 | It is no longer a trainer argument. Set it on SFTConfig and pass that as args (SFTConfig exists from v0.9.3). |
SFTTrainer model_init_kwargs | v0.7.3 | v0.12.2 | v0.13.0 | – |
SFTTrainer neftune_noise_alpha | v0.7.3 | v0.12.2 | v0.13.0 | It is no longer a trainer argument. Set it on SFTConfig and pass that as args (SFTConfig exists from v0.9.3). |
SFTTrainer num_of_sequences | v0.4.2 | v0.12.2 | v0.13.0 | – |
SFTTrainer packing | v0.4.2 | v0.12.2 | v0.13.0 | It is no longer a trainer argument. Set it on SFTConfig and pass that as args (SFTConfig exists from v0.9.3). |
SFTTrainer model_init | v0.4.2 | v0.14.0 | v0.15.0 | – |
SFTTrainer tokenizer | v0.4.2 | v0.11.4 (alias until v0.15.2) | v0.16.0 | Use processing_class (from v0.12.0). |
SFTConfig chars_per_token | v0.9.3 | v0.17.0 | v0.18.0 | – |
SFTConfig dataset_batch_size | v0.9.3 | v0.17.0 | v0.18.0 | – |
SFTConfig num_of_sequences | v0.9.3 | v0.17.0 | v0.18.0 | – |
SFTConfig use_liger | v0.10.1 | v0.17.0 | v0.18.0 | – |
SFTConfig max_seq_length | v0.9.3 | v0.19.1 | v0.20.0 | Rename it to max_length (from v0.16.0). |
DPOConfig max_target_length | v0.9.3 | v0.13.0 | v0.14.0 | It became max_completion_length (v0.11.0), which was removed after v0.28.0. |
DPOConfig is_encoder_decoder | v0.9.3 | v0.14.0 | v0.15.0 | – |
DPOConfig use_num_logits_to_keep | v0.13.0 | v0.16.1 | v0.17.0 | – |
DPOConfig padding_value | v0.9.3 | v0.25.1 | v0.26.0 | – |
DPOConfig use_liger_loss | v0.19.0 | v0.27.2 | v0.28.0 | – |
DPOConfig base_model_attribute_name | v0.19.0 | v0.28.0 | v0.29.0 | – |
DPOConfig force_use_ref_model | v0.9.3 | v0.28.0 | v0.29.0 | – |
DPOConfig generate_during_eval | v0.9.3 | v0.28.0 | v0.29.0 | – |
DPOConfig label_pad_token_id | v0.9.3 | v0.28.0 | v0.29.0 | – |
DPOConfig max_completion_length | v0.11.0 | v0.28.0 | v0.29.0 | Removed in v0.29.0. max_length still limits the whole tokenized sequence; filter or shorten long prompts in the dataset. |
DPOConfig max_prompt_length | v0.9.3 | v0.28.0 | v0.29.0 | Removed in v0.29.0. max_length still limits the whole tokenized sequence; filter or shorten long prompts in the dataset. |
DPOConfig model_adapter_name | v0.9.3 | v0.28.0 | v0.29.0 | – |
DPOConfig ref_adapter_name | v0.9.3 | v0.28.0 | v0.29.0 | – |
DPOConfig ref_model_init_kwargs | v0.9.3 | v0.28.0 | v0.29.0 | – |
DPOConfig reference_free | v0.9.3 | v0.28.0 | v0.29.0 | – |
DPOConfig rpo_alpha | v0.9.3 | v0.28.0 | v0.29.0 | – |
DPOConfig tools | v0.14.0 | v0.28.0 | v0.29.0 | – |
DPOConfig use_logits_to_keep | v0.15.0 | v0.28.0 | v0.29.0 | – |
TRL configs extend TrainingArguments, so SFTConfig(evaluation_strategy=...) fails or works according to the installed Transformers, not TRL. Names that only moved to TRL's shared base config in v0.29.0 (bf16, logging_steps, gradient_checkpointing, lr_scheduler_kwargs) are still accepted and are not listed. GRPOConfig, DPOTrainer and the other 82 TRL classes are in the lookup.
How was this built?
- Source: every final release tag of
huggingface/peft(39),huggingface/trl(103) andhuggingface/transformersfrom v4.0.0 (215), parsed with Python'sast. No library code was imported or run. - Config classes: the dataclass fields of the class plus those of its base classes in the same package (
LoraConfig+PeftConfig+PeftConfigMixin;SFTConfig+ TRL's base config). Fields declaredinit=Falseare left out. - Trainers: the parameters of
__init__. A name handled by@deprecate_kwargis counted as an alias for the releases that carry the decorator. - Replacements: taken from the deprecation message in the last release that still had the old name, and checked against the data: the build fails if a replacement did not exist in the stated release.
- The 0.14.0 change: the first release whose
src/peft/config.pycatches the TypeError and warns (commit 85e3202a).
What this page does not cover
- Nothing was executed. The page reports which names a constructor accepts, not whether a value is valid or what it does.
- Changed defaults and changed behaviour of an argument that kept its name.
- Transformers classes other than the four named above, and model or tokenizer
from_pretrainedarguments. - Release candidates, development installs and forks. An adapter saved from a PEFT source checkout can hold keys no release has yet.
- Arguments passed through
**kwargsto another library.
Questions
- What does "LoraConfig.__init__() got an unexpected keyword argument" mean?
- The adapter was saved with a newer PEFT than the one loading it: its adapter_config.json has a key your PEFT does not know. Each key has a first release, for example use_rslora 0.8.0, use_dora 0.9.0, layer_replication 0.10.0, lora_bias 0.14.0 and alora_invocation_tokens 0.18.0. Install at least the release of the newest key in the file. PEFT 0.14.0 and later no longer raise this error on load; they warn and ignore the unknown keys.
- Is it safe to delete the unknown key from adapter_config.json?
- Only if the key holds its default value, so that removing it changes nothing. A key such as use_dora set to true describes how the weights were trained; deleting it, or loading with PEFT 0.14.0 or later where it is ignored with a warning, loads a different model than the one that was saved. Upgrading PEFT is the safe fix.
- Why does TrainingArguments reject evaluation_strategy?
- evaluation_strategy was renamed to eval_strategy in Transformers 4.41.0. The old name kept working with a warning until 4.50.3 and is gone from 4.51.0. Write eval_strategy.
- Why does SFTTrainer reject tokenizer, dataset_text_field or max_seq_length?
- TRL moved them. tokenizer became processing_class in TRL 0.12.0; the old name was accepted with a warning until 0.15.2. dataset_text_field, max_seq_length and packing stopped being SFTTrainer arguments after 0.12.2 and belong on SFTConfig. On SFTConfig, max_seq_length was renamed to max_length in 0.16.0 and removed after 0.19.1.
- Why does Trainer reject tokenizer?
- Transformers 4.46.0 renamed the Trainer argument tokenizer to processing_class. The old name was accepted with a deprecation warning through 4.57.6 and removed in 5.0.0.
- How do I find which PEFT version saved an adapter?
- From PEFT 0.18.0 the file adapter_config.json records it in the key peft_version. Older files do not say; the newest key in the file gives a lower bound, which the lookup on this page computes.
Related: minimum Transformers and vLLM version for a model architecture · removed vLLM arguments, environment variables and request fields · GGUF architecture lookup · "cannot import name ... from 'transformers'": the releases that have each name.
Sources
- PEFT: tuners/lora/config.py, config.py, troubleshooting guide ("Error while loading the config because of an unexpected keyword argument")
- Transformers: training_args.py, trainer.py
- TRL: sft_config.py, sft_trainer.py, dpo_config.py