feat(ci): log into HF to unblock some CI tests (#3007)

* feat(ci): log into HF to unblock some CI tests

* chore(ci): change hf call + secret name

* fix(ci): temp fix for pi0 rtc test

* test(policies): require_cuda for unblocked tests

* test(policies): require_cuda wall_x

* fic(tests): require_cuda outter most for pi0

* fix(test): return instead of yield

---------

Signed-off-by: Steven Palma <imstevenpmwork@ieee.org>
This commit is contained in:
Steven Palma
2026-03-02 19:09:59 +01:00
committed by GitHub
parent 58451c7e81
commit e6c3ca499a
8 changed files with 34 additions and 39 deletions
+6
View File
@@ -61,6 +61,7 @@ jobs:
MUJOCO_GL: egl MUJOCO_GL: egl
HF_HOME: /mnt/cache/.cache/huggingface HF_HOME: /mnt/cache/.cache/huggingface
HF_LEROBOT_HOME: /mnt/cache/.cache/huggingface/lerobot HF_LEROBOT_HOME: /mnt/cache/.cache/huggingface/lerobot
HF_USER_TOKEN: ${{ secrets.LEROBOT_HF_USER }}
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
with: with:
@@ -89,5 +90,10 @@ jobs:
- name: Install lerobot with test extras - name: Install lerobot with test extras
run: uv sync --extra "test" run: uv sync --extra "test"
- name: Login to Hugging Face
run: |
uv run hf auth login --token "$HF_USER_TOKEN" --add-to-git-credential
uv run hf auth whoami
- name: Run pytest - name: Run pytest
run: uv run pytest tests -vv --maxfail=10 run: uv run pytest tests -vv --maxfail=10
+11
View File
@@ -60,6 +60,7 @@ jobs:
MUJOCO_GL: egl MUJOCO_GL: egl
HF_HOME: /mnt/cache/.cache/huggingface HF_HOME: /mnt/cache/.cache/huggingface
HF_LEROBOT_HOME: /mnt/cache/.cache/huggingface/lerobot HF_LEROBOT_HOME: /mnt/cache/.cache/huggingface/lerobot
HF_USER_TOKEN: ${{ secrets.LEROBOT_HF_USER }}
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
with: with:
@@ -87,6 +88,11 @@ jobs:
- name: Install lerobot with all extras - name: Install lerobot with all extras
run: uv sync --extra all # TODO(Steven): Make flash-attn optional run: uv sync --extra all # TODO(Steven): Make flash-attn optional
- name: Login to Hugging Face
run: |
uv run hf auth login --token "$HF_USER_TOKEN" --add-to-git-credential
uv run hf auth whoami
- name: Run pytest (all extras) - name: Run pytest (all extras)
run: uv run pytest tests -vv --maxfail=10 run: uv run pytest tests -vv --maxfail=10
@@ -162,6 +168,7 @@ jobs:
HF_LEROBOT_HOME: /home/user_lerobot/.cache/huggingface/lerobot HF_LEROBOT_HOME: /home/user_lerobot/.cache/huggingface/lerobot
TORCH_HOME: /home/user_lerobot/.cache/torch TORCH_HOME: /home/user_lerobot/.cache/torch
TRITON_CACHE_DIR: /home/user_lerobot/.cache/triton TRITON_CACHE_DIR: /home/user_lerobot/.cache/triton
HF_USER_TOKEN: ${{ secrets.LEROBOT_HF_USER }}
container: container:
image: ${{ needs.build-and-push-docker.outputs.image_tag }} # zizmor: ignore[unpinned-images] image: ${{ needs.build-and-push-docker.outputs.image_tag }} # zizmor: ignore[unpinned-images]
options: --gpus all --shm-size "16gb" options: --gpus all --shm-size "16gb"
@@ -173,6 +180,10 @@ jobs:
shell: bash shell: bash
working-directory: /lerobot working-directory: /lerobot
steps: steps:
- name: Login to Hugging Face
run: |
hf auth login --token "$HF_USER_TOKEN" --add-to-git-credential
hf auth whoami
- name: Fix ptxas permissions - name: Fix ptxas permissions
run: chmod +x /lerobot/.venv/lib/python3.10/site-packages/triton/backends/nvidia/bin/ptxas run: chmod +x /lerobot/.venv/lib/python3.10/site-packages/triton/backends/nvidia/bin/ptxas
- name: Run pytest on GPU - name: Run pytest on GPU
@@ -17,7 +17,6 @@
"""Test script to verify PI0Fast policy integration with LeRobot vs the original implementation""" """Test script to verify PI0Fast policy integration with LeRobot vs the original implementation"""
# ruff: noqa: E402 # ruff: noqa: E402
import os
import random import random
from copy import deepcopy from copy import deepcopy
from typing import Any from typing import Any
@@ -28,10 +27,6 @@ import torch
pytest.importorskip("transformers") pytest.importorskip("transformers")
pytest.importorskip("scipy") 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",
)
from lerobot.policies.pi0_fast.configuration_pi0_fast import PI0FastConfig from lerobot.policies.pi0_fast.configuration_pi0_fast import PI0FastConfig
from lerobot.policies.pi0_fast.modeling_pi0_fast import PI0FastPolicy from lerobot.policies.pi0_fast.modeling_pi0_fast import PI0FastPolicy
@@ -53,7 +48,7 @@ DUMMY_STATE_DIM = 20
IMAGE_HEIGHT = 224 IMAGE_HEIGHT = 224
IMAGE_WIDTH = 224 IMAGE_WIDTH = 224
NUM_VIEWS = 2 # Number of camera views NUM_VIEWS = 2 # Number of camera views
DEVICE = "cuda" if torch.cuda.is_available() else "cpu" DEVICE = "cuda"
MODEL_PATH_LEROBOT = "jadechoghari/pi0fast-base" MODEL_PATH_LEROBOT = "jadechoghari/pi0fast-base"
# Expected action token shape: (batch_size, max_decoding_steps) # Expected action token shape: (batch_size, max_decoding_steps)
@@ -69,6 +64,7 @@ EXPECTED_ACTIONS_STD = 0.2607129216194153
EXPECTED_ACTIONS_FIRST_5 = torch.tensor([0.0000, 0.3536, 0.0707, 0.0000, 0.0000]) EXPECTED_ACTIONS_FIRST_5 = torch.tensor([0.0000, 0.3536, 0.0707, 0.0000, 0.0000])
@require_cuda
def set_seed_all(seed: int): def set_seed_all(seed: int):
"""Set random seed for all RNG sources to ensure reproducibility.""" """Set random seed for all RNG sources to ensure reproducibility."""
random.seed(seed) random.seed(seed)
@@ -85,6 +81,7 @@ def set_seed_all(seed: int):
torch.use_deterministic_algorithms(True, warn_only=True) torch.use_deterministic_algorithms(True, warn_only=True)
@require_cuda
def instantiate_lerobot_pi0_fast( def instantiate_lerobot_pi0_fast(
from_pretrained: bool = False, from_pretrained: bool = False,
model_path: str = MODEL_PATH_LEROBOT, model_path: str = MODEL_PATH_LEROBOT,
@@ -127,6 +124,7 @@ def instantiate_lerobot_pi0_fast(
return policy, preprocessor, postprocessor return policy, preprocessor, postprocessor
@require_cuda
def create_dummy_data(device=DEVICE): def create_dummy_data(device=DEVICE):
"""Create dummy data for testing both implementations.""" """Create dummy data for testing both implementations."""
batch_size = 1 batch_size = 1
@@ -158,22 +156,25 @@ def create_dummy_data(device=DEVICE):
# Pytest fixtures # Pytest fixtures
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
@require_cuda
def pi0_fast_components(): def pi0_fast_components():
"""Fixture to instantiate and provide all PI0Fast components for tests.""" """Fixture to instantiate and provide all PI0Fast components for tests."""
print(f"\nTesting with DEVICE='{DEVICE}'") print(f"\nTesting with DEVICE='{DEVICE}'")
print("\n[Setup] Instantiating LeRobot PI0Fast policy...") print("\n[Setup] Instantiating LeRobot PI0Fast policy...")
policy_obj, preprocessor_obj, postprocessor_obj = instantiate_lerobot_pi0_fast(from_pretrained=True) policy_obj, preprocessor_obj, postprocessor_obj = instantiate_lerobot_pi0_fast(from_pretrained=True)
print("Model loaded successfully") print("Model loaded successfully")
yield policy_obj, preprocessor_obj, postprocessor_obj return policy_obj, preprocessor_obj, postprocessor_obj
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
@require_cuda
def policy(pi0_fast_components): def policy(pi0_fast_components):
"""Fixture to provide the PI0Fast policy for tests.""" """Fixture to provide the PI0Fast policy for tests."""
return pi0_fast_components[0] return pi0_fast_components[0]
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
@require_cuda
def preprocessor(pi0_fast_components): def preprocessor(pi0_fast_components):
"""Fixture to provide the PI0Fast preprocessor for tests.""" """Fixture to provide the PI0Fast preprocessor for tests."""
return pi0_fast_components[1] return pi0_fast_components[1]
-9
View File
@@ -16,17 +16,8 @@
"""Test script to verify PI0 policy integration with LeRobot, only meant to be run locally!""" """Test script to verify PI0 policy integration with LeRobot, only meant to be run locally!"""
import os
import pytest
import torch 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 accepting the model license",
)
from lerobot.policies.factory import make_policy_config # noqa: E402 from lerobot.policies.factory import make_policy_config # noqa: E402
from lerobot.policies.pi0 import ( # noqa: E402 from lerobot.policies.pi0 import ( # noqa: E402
PI0Config, PI0Config,
+1 -11
View File
@@ -16,25 +16,15 @@
"""Test script to verify PI0.5 (pi05) support in PI0 policy, only meant to be run locally!""" """Test script to verify PI0.5 (pi05) support in PI0 policy, only meant to be run locally!"""
import os
import pytest
import torch import torch
from lerobot.utils.random_utils import set_seed
# 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 accepting the model license",
)
from lerobot.policies.factory import make_policy_config # noqa: E402 from lerobot.policies.factory import make_policy_config # noqa: E402
from lerobot.policies.pi05 import ( # noqa: E402 from lerobot.policies.pi05 import ( # noqa: E402
PI05Config, PI05Config,
PI05Policy, PI05Policy,
make_pi05_pre_post_processors, # noqa: E402 make_pi05_pre_post_processors, # noqa: E402
) )
from lerobot.utils.random_utils import set_seed
from tests.utils import require_cuda # noqa: E402 from tests.utils import require_cuda # noqa: E402
+2 -1
View File
@@ -24,9 +24,10 @@ import torch
# Skip this entire module in CI # Skip this entire module in CI
pytestmark = pytest.mark.skipif( pytestmark = pytest.mark.skipif(
os.environ.get("CI") == "true" or os.environ.get("GITHUB_ACTIONS") == "true", 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", reason="TODO: This test seems to hang the CI",
) )
from lerobot.configs.types import FeatureType, PolicyFeature, RTCAttentionSchedule # noqa: E402 from lerobot.configs.types import FeatureType, PolicyFeature, RTCAttentionSchedule # noqa: E402
from lerobot.policies.pi05 import PI05Config, PI05Policy, make_pi05_pre_post_processors # noqa: E402 from lerobot.policies.pi05 import PI05Config, PI05Policy, make_pi05_pre_post_processors # noqa: E402
from lerobot.policies.rtc.configuration_rtc import RTCConfig # noqa: E402 from lerobot.policies.rtc.configuration_rtc import RTCConfig # noqa: E402
+3 -1
View File
@@ -24,9 +24,10 @@ import torch
# Skip this entire module in CI # Skip this entire module in CI
pytestmark = pytest.mark.skipif( pytestmark = pytest.mark.skipif(
os.environ.get("CI") == "true" or os.environ.get("GITHUB_ACTIONS") == "true", 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", reason="TODO: This test seems to hang the CI",
) )
from lerobot.configs.types import FeatureType, PolicyFeature, RTCAttentionSchedule # noqa: E402 from lerobot.configs.types import FeatureType, PolicyFeature, RTCAttentionSchedule # noqa: E402
from lerobot.policies.pi0 import PI0Config, PI0Policy, make_pi0_pre_post_processors # noqa: E402 from lerobot.policies.pi0 import PI0Config, PI0Policy, make_pi0_pre_post_processors # noqa: E402
from lerobot.policies.rtc.configuration_rtc import RTCConfig # noqa: E402 from lerobot.policies.rtc.configuration_rtc import RTCConfig # noqa: E402
@@ -88,6 +89,7 @@ def test_pi0_rtc_initialization_without_rtc_config():
print("✓ PI0 RTC initialization without RTC config: Test passed") print("✓ PI0 RTC initialization without RTC config: Test passed")
@require_cuda
def test_pi0_rtc_inference_with_prev_chunk(): def test_pi0_rtc_inference_with_prev_chunk():
"""Test PI0 policy inference with RTC and previous chunk.""" """Test PI0 policy inference with RTC and previous chunk."""
set_seed(42) set_seed(42)
+3 -10
View File
@@ -16,15 +16,10 @@
"""Test script to verify Wall-X policy integration with LeRobot, only meant to be run locally!""" """Test script to verify Wall-X policy integration with LeRobot, only meant to be run locally!"""
import os
import pytest import pytest
import torch import torch
pytestmark = pytest.mark.skipif(
os.environ.get("CI") == "true" or os.environ.get("GITHUB_ACTIONS") == "true",
reason="This test exceeds available memory in CI environments.",
)
# Skip if required dependencies are not available # Skip if required dependencies are not available
pytest.importorskip("peft") pytest.importorskip("peft")
pytest.importorskip("transformers") pytest.importorskip("transformers")
@@ -35,8 +30,10 @@ from lerobot.policies.wall_x import WallXConfig # noqa: E402
from lerobot.policies.wall_x.modeling_wall_x import WallXPolicy # noqa: E402 from lerobot.policies.wall_x.modeling_wall_x import WallXPolicy # noqa: E402
from lerobot.policies.wall_x.processor_wall_x import make_wall_x_pre_post_processors # noqa: E402 from lerobot.policies.wall_x.processor_wall_x import make_wall_x_pre_post_processors # noqa: E402
from lerobot.utils.random_utils import set_seed # noqa: E402 from lerobot.utils.random_utils import set_seed # noqa: E402
from tests.utils import require_cuda # noqa: E402
@require_cuda
def test_policy_instantiation(): def test_policy_instantiation():
# Create config # Create config
set_seed(42) set_seed(42)
@@ -121,6 +118,7 @@ def test_policy_instantiation():
raise raise
@require_cuda
def test_config_creation(): def test_config_creation():
"""Test policy config creation through factory.""" """Test policy config creation through factory."""
try: try:
@@ -132,8 +130,3 @@ def test_config_creation():
except Exception as e: except Exception as e:
print(f"Config creation failed: {e}") print(f"Config creation failed: {e}")
raise raise
if __name__ == "__main__":
test_policy_instantiation()
test_config_creation()