# ValueError: 名为 'default' 的适配器已加载。请使用唯一的适配器名称或禁用此适配器。

- **ID:** `huggingface/peft-adapter-name-collision`
- **领域:** huggingface
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

PEFT（参数高效微调）阻止加载同名适配器以避免权重冲突。当使用相同名称两次调用 `load_adapter` 或名为 'default' 的适配器已激活时，会发生此错误。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| peft>=0.6.0 | active | — | — |
| transformers>=4.31.0 | active | — | — |
| torch>=1.13.0 | active | — | — |

## 解决方案

1. ```
   Use a unique name for each adapter load, such as including a timestamp or identifier. For example: `model.load_adapter(peft_model_id, adapter_name='my_adapter_v2')`.
   ```
2. ```
   Disable the current adapter before loading a new one with the same name using `model.disable_adapter()`.
   ```

## 无效尝试

- **** — Removing the adapter with `delete_adapter('default')` before loading a new one may cause errors if the adapter is currently active and the model has been trained with it. (30% 失败率)
- **** — Setting `adapter_name=None` in `load_adapter` does not auto-generate a unique name; it defaults to 'default' again. (50% 失败率)
