huggingface config_error ai_generated true

RuntimeError: PEFT adapter 'my_adapter' not found in checkpoint. Available adapters: ['base', 'lora_v1']

ID: huggingface/peft-adapter-not-found-in-checkpoint

Also available as: JSON · Markdown · 中文
92%Fix Rate
88%Confidence
1Evidence
2024-01-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
huggingface/peft 0.9.0 active
huggingface/peft 0.10.0 active
huggingface/transformers 4.38.0 active

Root Cause

The requested PEFT adapter name does not match any adapter stored in the checkpoint directory or merged model.

generic

中文

请求的 PEFT 适配器名称与检查点目录或合并模型中存储的任何适配器不匹配。

Official Documentation

https://huggingface.co/docs/peft/en/quicktour#load-and-use-an-adapter

Workarounds

  1. 95% success List available adapters and load the correct one: `model.load_adapter('lora_v1')` or `PeftModel.from_pretrained(model, 'path/to/checkpoint', adapter_name='lora_v1')`
    List available adapters and load the correct one: `model.load_adapter('lora_v1')` or `PeftModel.from_pretrained(model, 'path/to/checkpoint', adapter_name='lora_v1')`
  2. 85% success If loading a single adapter, use `PeftModel.from_pretrained(model, 'path/to/checkpoint')` without specifying adapter_name, which defaults to 'default'.
    If loading a single adapter, use `PeftModel.from_pretrained(model, 'path/to/checkpoint')` without specifying adapter_name, which defaults to 'default'.

中文步骤

  1. List available adapters and load the correct one: `model.load_adapter('lora_v1')` or `PeftModel.from_pretrained(model, 'path/to/checkpoint', adapter_name='lora_v1')`
  2. If loading a single adapter, use `PeftModel.from_pretrained(model, 'path/to/checkpoint')` without specifying adapter_name, which defaults to 'default'.

Dead Ends

Common approaches that don't work:

  1. Rename the adapter folder to 'my_adapter' manually 80% fail

    PEFT uses internal metadata to track adapter names; renaming the folder without updating the metadata file (adapter_config.json) causes a mismatch.

  2. Set `load_in_8bit=True` to bypass adapter loading 90% fail

    Loading in 8-bit doesn't skip adapter loading; it still tries to find the adapter and fails with the same error.