Add peft as extra dependency, mark tests

Fast tests currently fail because of the missing dependency.
This commit is contained in:
nemo
2025-12-20 19:19:06 +01:00
parent 4bc75776f7
commit ad4a82b77e
3 changed files with 11 additions and 1 deletions
+6
View File
@@ -5,6 +5,8 @@ from unittest.mock import MagicMock, patch
import pytest
from safetensors.torch import load_file
from .utils import require_package
def run_command(cmd, module, args):
module = importlib.import_module(f"lerobot.scripts.{module}")
@@ -29,6 +31,7 @@ def resolve_model_id_for_peft_training(policy_type):
@pytest.mark.parametrize("policy_type", ["smolvla"])
@require_package("peft")
def test_peft_training_push_to_hub_works(policy_type, tmp_path):
"""Ensure that push to hub stores PEFT only the adapter, not the full model weights."""
output_dir = tmp_path / f"output_{policy_type}"
@@ -67,6 +70,7 @@ def test_peft_training_push_to_hub_works(policy_type, tmp_path):
@pytest.mark.parametrize("policy_type", ["smolvla"])
@require_package("peft")
def test_peft_training_works(policy_type, tmp_path):
"""Check whether the standard case of fine-tuning a (partially) pre-trained policy with PEFT works."""
output_dir = tmp_path / f"output_{policy_type}"
@@ -115,6 +119,7 @@ def test_peft_training_works(policy_type, tmp_path):
@pytest.mark.parametrize("policy_type", ["smolvla"])
@require_package("peft")
def test_peft_training_params_are_fewer(policy_type, tmp_path):
"""Check whether the standard case of fine-tuning a (partially) pre-trained policy with PEFT works."""
output_dir = tmp_path / f"output_{policy_type}"
@@ -165,6 +170,7 @@ def dummy_make_robot_from_config(*args, **kwargs):
@pytest.mark.parametrize("policy_type", ["smolvla"])
@require_package("peft")
def test_peft_record_loads_policy(policy_type, tmp_path):
"""Train a policy with PEFT and attempt to load it with `lerobot-record`."""
from peft import PeftModel