镜像自地址
https://github.com/MINT-SJTU/Evo-RL.git
已同步 2026-11-20 18:17:06 +00:00
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
这个提交包含在:
@ -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)
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户