执行摘要
- 一句话:ARM CI 无条件跳过需模型下载的 e2e 测试
- 推荐动作:该 PR 为临时性 CI 调整,值得关注的是设计决策:kernel 测试前置确保基础功能覆盖,e2e 测试在有 HF_TOKEN 时正常执行。
功能与动机
PR body 指出 CI agent 未设置 HF_TOKEN,导致模型下载触发 Hugging Face Hub 速率限制,影响 e2e 测试稳定性。
实现拆解
- 在
.buildkite/scripts/hardware_ci/run-cpu-test-arm.sh 的 cpu_tests() 函数中,将 kernel 测试(无需下载模型)提前执行。
- 在 kernel 测试之后,添加
if [ -z "$HF_TOKEN" ] 判断,若环境变量未设置则打印警告并 return,跳过后续的离线推理、模型测试和在线 serving 测试。
- 原脚本中 kernel 测试位于模型测试之后,现将其前置以确保始终运行。
关键文件:
.buildkite/scripts/hardware_ci/run-cpu-test-arm.sh(模块 CI脚本;类别 infra;类型 infrastructure): 唯一变更文件,调整 ARM CI 测试执行顺序并添加 HF_TOKEN 检测条件,避免无 token 时 e2e 测试因速率限制失败。
关键符号:cpu_tests
关键源码片段
.buildkite/scripts/hardware_ci/run-cpu-test-arm.sh
唯一变更文件,调整 ARM CI 测试执行顺序并添加 HF_TOKEN 检测条件,避免无 token 时 e2e 测试因速率限制失败。
# kernel tests — no model download, always run
docker exec cpu-test bash -c "
set -e
pytest -x -v -s tests/kernels/test_onednn.py
pytest -x -v -s tests/kernels/attention/test_cpu_attn.py
pytest -x -v -s tests/kernels/core/test_cpu_activation.py
pytest -x -v -s tests/kernels/moe/test_moe.py -k test_cpu_fused_moe_basic
"
# skip tests requiring model downloads if HF_TOKEN is not set
# due to rate-limits on Hugging Face Hub
if [ -z "$HF_TOKEN" ]; then
echo "Warning: HF_TOKEN is not set. Skipping tests that require model downloads."
return # exit cpu_tests early, kernel tests have already run
fi
# offline inference (requires model download)
docker exec cpu-test bash -c "
set -e
...
"
评论区精华
haosdent 建议在 cpu.yaml 中使用 skip 属性跳过整个 job,但 fadara01 指出这会跳过所有测试(包括 kernel 测试),不可取。haosdent 随后建议在脚本内检测 HF_TOKEN 后 return,fadara01 接受该方案。
- 使用 skip 属性 vs 脚本内 return (design): 采用脚本内检测 HF_TOKEN 后 return 的方案,kernel 测试始终运行。
风险与影响
- 风险:kernel 测试始终运行,无回归风险。e2e 测试在 HF_TOKEN 缺失时被跳过,若 HF_TOKEN 后续配置但未恢复脚本,则 e2e 测试会被错误跳过,需确保 CI agent 配置 HF_TOKEN 后及时移除该逻辑。
- 影响:仅影响 ARM CPU CI 的 e2e 测试阶段。kernel 测试不受影响。用户无感知。
- 风险标记:临时性变更, 缺少 HF_TOKEN 恢复后自动移除检测的机制
关联脉络
参与讨论