Prhub

#40306 [ROCm][CI] Fix `trust_remote_code` AttributeError in EAGLE3 acceptance length test

原始 PR 作者 AndreasKaratzas 合并时间 2026-04-25 10:59 文件变更 1 提交数 1 评论 0 代码增减 +3 / -2

执行摘要

修复 EAGLE3 测试中缺失 trust_remote_code 属性错误

测试 test_eagle3_acceptance_lengthtrust_remote_code 属性缺失而失败,影响 ROCm CI 流程。PR body 明确描述了问题:get_samples 读取 args.trust_remote_code 时抛出 AttributeError。

建议合并,修复简单直接,经过 approve。

讨论亮点

无人工评论,机器人自动审核通过。

实现拆解

  1. 修复属性缺失:在 tests/v1/spec_decode/test_acceptance_length.pyget_mt_bench_prompts 函数中,向 SimpleNamespace 添加 trust_remote_code=False 属性。
  2. 放宽平台条件:将 @pytest.mark.skipif 中的 is_cuda() 改为 is_cuda_alike(),使测试能在 ROCm 等 CUDA 兼容平台上运行。
文件 模块 状态 重要度
tests/v1/spec_decode/test_acceptance_length.py 测试 modified 4.06

关键符号

get_mt_bench_prompts

关键源码片段

tests/v1/spec_decode/test_acceptance_length.py test-coverage

修复测试中 SimpleNamespace 缺少 trust_remote_code 属性导致 AttributeError,并放宽平台检查条件。

# 修改前:SimpleNamespace 缺少 trust_remote_code 属性,导致 get_samples 中访问 args.trust_remote_code 时出现 AttributeError。
args = SimpleNamespace(
    dataset_name="hf",
    dataset_path="philschmid/mt-bench",
    num_prompts=num_prompts,
    seed=42,
    no_oversample=False,
    endpoint_type="openai-chat",
    input_len=None,
    output_len=DEFAULT_OUTPUT_LEN,
    sharegpt_output_len=DEFAULT_OUTPUT_LEN,
    hf_name=None,
    hf_split="train",
    hf_subset=None,
    hf_output_len=DEFAULT_OUTPUT_LEN,
    no_stream=True,
    disable_shuffle=False,
    skip_chat_template=False,
    trust_remote_code=False, # 新增:显式禁用远端代码执行,避免 AttributeError
)

# 修改前:@pytest.mark.skipif(not current_platform.is_cuda(), ...) # 仅限 CUDA# 修改后:放宽为 CUDA 兼容平台(如 ROCm)
@pytest.mark.skipif(
    not current_platform.is_cuda_alike(),
    reason="This test is only supported on CUDA-alike platforms.",
)

评论区精华

没有提炼出高价值讨论线程

当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。

风险与影响

风险极低。仅修改测试文件,添加一个配置项并放宽平台条件,不影响生产代码。

影响范围仅限于测试 test_eagle3_acceptance_length。修复后该测试可在 ROCm 及 CUDA 平台正确运行,提升了 CI 对 AMD GPU 的覆盖。

关联 Issue

未识别关联 Issue

当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。

完整报告

参与讨论