# 值错误：加载此模型需要trust_remote_code=True。请参阅https://huggingface.co/docs/hub/security

- **ID:** `huggingface/trust-remote-code-required`
- **领域:** huggingface
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 93%

## 根因

模型仓库包含必须本地执行的自定义Python代码（例如建模文件）；出于安全原因未设置trust_remote_code标志。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| transformers>=4.30.0 | active | — | — |

## 解决方案

1. ```
   Set trust_remote_code=True in from_pretrained after reviewing the custom code.
   ```
2. ```
   Download and inspect the custom code files, then load with trust_remote_code=True.
   ```
3. ```
   Use the transformers CLI to download the model and then load with trust_remote_code.
   ```

## 无效尝试

- **** — This parameter does not address the remote code execution requirement. (98% 失败率)
- **** — Custom code is still required even from local files; trust_remote_code must be set. (85% 失败率)
