huggingface config_error ai_generated true

RuntimeError: 检查点中未找到 PEFT 适配器 'my_adapter'。可用适配器:['base', 'lora_v1']

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

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

其他格式: JSON · Markdown 中文 · English
92%修复率
88%置信度
1证据数
2024-01-20首次发现

版本兼容性

版本状态引入弃用备注
huggingface/peft 0.9.0 active
huggingface/peft 0.10.0 active
huggingface/transformers 4.38.0 active

根因分析

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

English

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

generic

官方文档

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

解决方案

  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'.

无效尝试

常见但无效的做法:

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

    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% 失败

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