test(fast): align fast-test behavior with current runtime constraints

- gate PI0/PI0Fast tests on HF token availability for gated models

- update value infer viz tests to current API ownership and arguments

- align piper calibration assertion with runtime error message

- set HF_HUB_DISABLE_XET in fast_tests workflow
这个提交包含在:
Elvin
2026-03-06 16:31:02 +08:00
父节点 fa435f8312
当前提交 5975798aef
共有 5 个文件被更改,包括 22 次插入 和 10 次删除

查看文件

@ -61,6 +61,8 @@ jobs:
MUJOCO_GL: egl
HF_HOME: /mnt/cache/.cache/huggingface
HF_LEROBOT_HOME: /mnt/cache/.cache/huggingface/lerobot
# Keep dataset/model downloads on the regular Hub path in CI to avoid hf_xet flakiness.
HF_HUB_DISABLE_XET: "1"
steps:
- uses: actions/checkout@v6
with:

查看文件

@ -29,8 +29,10 @@ import torch
pytest.importorskip("transformers")
pytest.importorskip("scipy")
pytestmark = pytest.mark.skipif(
os.environ.get("CI") == "true" or os.environ.get("GITHUB_ACTIONS") == "true",
reason="This test requires accepting the model license",
os.environ.get("CI") == "true"
or os.environ.get("GITHUB_ACTIONS") == "true"
or not (os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN")),
reason="This test requires accepted model license and authenticated HF access token",
)
from lerobot.policies.pi0_fast.configuration_pi0_fast import PI0FastConfig

查看文件

@ -23,8 +23,10 @@ import torch
# Skip this entire module in CI
pytestmark = pytest.mark.skipif(
os.environ.get("CI") == "true" or os.environ.get("GITHUB_ACTIONS") == "true",
reason="This test requires local OpenPI installation and is not meant for CI",
os.environ.get("CI") == "true"
or os.environ.get("GITHUB_ACTIONS") == "true"
or not (os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN")),
reason="This test requires local OpenPI setup and authenticated HF access token",
)
from lerobot.configs.types import FeatureType, PolicyFeature, RTCAttentionSchedule # noqa: E402

查看文件

@ -205,9 +205,9 @@ def test_piper_requires_calibration(monkeypatch):
teleop.connect(calibrate=False)
robot.connect(calibrate=False)
try:
with pytest.raises(RuntimeError, match="require calibration"):
with pytest.raises(RuntimeError, match="is not calibrated"):
teleop.get_action()
with pytest.raises(RuntimeError, match="require calibration"):
with pytest.raises(RuntimeError, match="is not calibrated"):
robot.send_action({"joint_1.pos": 0.0})
finally:
teleop.disconnect()

查看文件

@ -96,6 +96,7 @@ def test_export_overlay_videos_uses_episode_index_for_subset_alignment(monkeypat
video_backend,
frame_storage_mode,
temp_dir_root,
smooth_window=1,
):
assert isinstance(src, Path)
assert isinstance(dst, Path)
@ -108,17 +109,19 @@ def test_export_overlay_videos_uses_episode_index_for_subset_alignment(monkeypat
assert isinstance(ep_values, np.ndarray)
assert isinstance(ep_advantages, np.ndarray)
assert isinstance(ep_indicators, np.ndarray)
assert smooth_window == 1
return dst
monkeypatch.setattr(value_infer_viz, "_export_single_episode", _fake_export_single_episode)
written = value_infer._export_overlay_videos(
written = value_infer_viz._export_overlay_videos(
dataset=dataset,
value_field="complementary_info.value",
advantage_field="complementary_info.advantage",
indicator_field="complementary_info.acp_indicator",
viz_episodes="all",
video_key=None,
video_keys=None,
output_dir=tmp_path,
overwrite=True,
vcodec="libsvtav1",
@ -146,22 +149,25 @@ def test_export_overlay_videos_passes_disk_storage_mode(monkeypatch, tmp_path: P
video_backend,
frame_storage_mode,
temp_dir_root,
smooth_window=1,
):
assert isinstance(episode_timestamps_s, np.ndarray)
assert tolerance_s > 0
assert frame_storage_mode == "disk"
assert temp_dir_root == tmp_path
assert smooth_window == 1
return dst
monkeypatch.setattr(value_infer_viz, "_export_single_episode", _fake_export_single_episode)
written = value_infer._export_overlay_videos(
written = value_infer_viz._export_overlay_videos(
dataset=dataset,
value_field="complementary_info.value",
advantage_field="complementary_info.advantage",
indicator_field="complementary_info.acp_indicator",
viz_episodes="all",
video_key=None,
video_keys=None,
output_dir=tmp_path,
overwrite=True,
vcodec="h264",
@ -172,7 +178,7 @@ def test_export_overlay_videos_passes_disk_storage_mode(monkeypatch, tmp_path: P
def test_get_video_encode_options_for_h264_nvenc():
options, pix_fmt = value_infer._get_video_encode_options("h264_nvenc")
options, pix_fmt = value_infer_viz._get_video_encode_options("h264_nvenc")
assert pix_fmt == "yuv420p"
assert options["preset"] == "p4"
assert options["rc"] == "vbr"
@ -183,7 +189,7 @@ def test_get_video_encode_options_for_h264_nvenc():
def test_get_episode_value_bounds_returns_episode_min_max():
y_min, y_max = value_infer._get_episode_value_bounds(np.array([-0.7, -0.3, -0.5], dtype=np.float32))
y_min, y_max = value_infer_viz._get_episode_value_bounds(np.array([-0.7, -0.3, -0.5], dtype=np.float32))
assert np.isclose(y_min, -0.7)
assert np.isclose(y_max, -0.3)