# PR #6540 完整报告

- 仓库：`verl-project/verl`
- 标题：[veomni] fix: VeOmniEngineWithValueHead token-cls lookup default value for transformers v5
- 合并时间：2026-06-01 10:29
- 原文链接：http://prhub.com.cn/verl-project/verl/pull/6540

---

# 执行摘要

- 一句话：修复 VeOmni value model 初始化崩溃
- 推荐动作：可快速合入。该 PR 属于常规适配修复，无需深入精读。

# 功能与动机

transformers 5.x 中 `_LazyAutoMapping.get(key, default)` 将 `default` 变为强制位置参数，与旧版 `dict.get(key)` 行为不同，导致 value model critic 初始化时抛出 `TypeError: _LazyAutoMapping.get() missing 1 required positional argument`。

# 实现拆解

在 `verl/workers/engine/veomni/transformer_impl.py` 的 `VeOmniEngineWithValueHead._get_model_config_path` 方法中，将 `AutoModelForTokenClassification._model_mapping.get(type(config))` 改为 `AutoModelForTokenClassification._model_mapping.get(type(config), None)`，显式提供默认值 `None`。该行后的 `if token_cls is None` 守卫逻辑保持不变，因此行为等价。

关键文件：
- `verl/workers/engine/veomni/transformer_impl.py`（模块 引擎；类别 source；类型 core-logic；符号 VeOmniEngineWithValueHead._get_model_config_path）: 修复 transformers 5.x 中 _LazyAutoMapping.get 缺少默认参数导致的崩溃

关键符号：VeOmniEngineWithValueHead._get_model_config_path

## 关键源码片段

### `verl/workers/engine/veomni/transformer_impl.py`

修复 transformers 5.x 中 _LazyAutoMapping.get 缺少默认参数导致的崩溃

```python
# verl/workers/engine/veomni/transformer_impl.py
# 修复：transformers 5.x 中 _LazyAutoMapping.get(key, default) 将 default 变为强制参数
# 显式传入 None 以兼容新版 transformers，后续 None 检查保持不变
config.tie_word_embeddings = False
token_cls = AutoModelForTokenClassification._model_mapping.get(type(config), None)
if token_cls is None:
    raise ValueError(f"No ForTokenClassification class in transformers for {type(config).__name__}.")
config.architectures = [token_cls.__name__]
return config

```

# 评论区精华

无 review 讨论。自动化机器人 gemini-code-assist[bot] 仅确认变更无问题，wuxibin89 直接批准。

- 缺少默认参数的兼容性修复 (correctness): PR 获得批准，无需讨论。

# 风险与影响

- 风险：风险极低。仅 1 行改动，显式指定 `None` 作为默认值，与后续 None 检查完全兼容。不影响旧版 transformers 行为。
- 影响：影响范围仅限于 VeOmni 后端的 value model (critic) 初始化流程，修复 transformers 5.x 兼容性。对训练稳定性无其他影响。
- 风险标记：兼容性修复

# 关联脉络

- PR #6511 [veomni, fsdp] feat: enable fused top-K distillation kernel for OPD: 涉及相同文件，进一步扩展 VeOmniEngine 功能