From 49d64c902876b2da6ebbffbc3234d59f2cd474f2 Mon Sep 17 00:00:00 2001 From: Khalil Meftah Date: Mon, 16 Mar 2026 16:09:27 +0100 Subject: [PATCH] fix: move rabc.py to rewards/sarm/ and update import paths --- src/lerobot/{policies => rewards}/sarm/rabc.py | 0 src/lerobot/utils/sample_weighting.py | 4 ++-- tests/utils/test_sample_weighting.py | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) rename src/lerobot/{policies => rewards}/sarm/rabc.py (100%) diff --git a/src/lerobot/policies/sarm/rabc.py b/src/lerobot/rewards/sarm/rabc.py similarity index 100% rename from src/lerobot/policies/sarm/rabc.py rename to src/lerobot/rewards/sarm/rabc.py diff --git a/src/lerobot/utils/sample_weighting.py b/src/lerobot/utils/sample_weighting.py index 1e9329a6a..83eec3126 100644 --- a/src/lerobot/utils/sample_weighting.py +++ b/src/lerobot/utils/sample_weighting.py @@ -149,7 +149,7 @@ def _make_rabc_weighter( dataset_repo_id: HuggingFace repo ID (for auto-detecting progress_path). """ # Import here to avoid circular imports and keep RABC code in SARM module - from lerobot.policies.sarm.rabc import RABCWeights + from lerobot.rewards.sarm.rabc import RABCWeights # Extract chunk_size from policy config chunk_size = getattr(policy.config, "chunk_size", None) @@ -171,7 +171,7 @@ def _make_rabc_weighter( "RABC sample weighting requires 'progress_path' to be set, " "or dataset_root/dataset_repo_id for auto-detection. " "Generate progress values using: " - "python -m lerobot.policies.sarm.compute_rabc_weights --help" + "python -m lerobot.rewards.sarm.compute_rabc_weights --help" ) return RABCWeights( diff --git a/tests/utils/test_sample_weighting.py b/tests/utils/test_sample_weighting.py index e0055d317..dee0511ef 100644 --- a/tests/utils/test_sample_weighting.py +++ b/tests/utils/test_sample_weighting.py @@ -268,7 +268,7 @@ def test_factory_rabc_auto_detects_from_dataset_root(sample_progress_parquet): ) assert weighter is not None - from lerobot.policies.sarm.rabc import RABCWeights + from lerobot.rewards.sarm.rabc import RABCWeights assert isinstance(weighter, RABCWeights) @@ -306,7 +306,7 @@ def test_factory_rabc_auto_detects_from_repo_id(): def test_rabc_weights_is_sample_weighter(sample_progress_parquet): """Test that RABCWeights inherits from SampleWeighter.""" - from lerobot.policies.sarm.rabc import RABCWeights + from lerobot.rewards.sarm.rabc import RABCWeights weighter = RABCWeights( progress_path=sample_progress_parquet, @@ -318,7 +318,7 @@ def test_rabc_weights_is_sample_weighter(sample_progress_parquet): def test_rabc_compute_batch_weights(sample_progress_parquet): """Test RABCWeights.compute_batch_weights returns correct structure.""" - from lerobot.policies.sarm.rabc import RABCWeights + from lerobot.rewards.sarm.rabc import RABCWeights weighter = RABCWeights( progress_path=sample_progress_parquet, @@ -338,7 +338,7 @@ def test_rabc_compute_batch_weights(sample_progress_parquet): def test_rabc_get_stats(sample_progress_parquet): """Test RABCWeights.get_stats returns expected structure.""" - from lerobot.policies.sarm.rabc import RABCWeights + from lerobot.rewards.sarm.rabc import RABCWeights weighter = RABCWeights( progress_path=sample_progress_parquet, @@ -360,7 +360,7 @@ def test_rabc_get_stats(sample_progress_parquet): def test_factory_creates_rabc_weighter(sample_progress_parquet): """Test factory creates RABCWeights with valid config.""" - from lerobot.policies.sarm.rabc import RABCWeights + from lerobot.rewards.sarm.rabc import RABCWeights config = SampleWeightingConfig( type="rabc", @@ -381,7 +381,7 @@ def test_factory_creates_rabc_weighter(sample_progress_parquet): def test_rabc_weights_normalization(sample_progress_parquet): """Test that RABCWeights normalizes weights to sum to batch_size.""" - from lerobot.policies.sarm.rabc import RABCWeights + from lerobot.rewards.sarm.rabc import RABCWeights weighter = RABCWeights( progress_path=sample_progress_parquet,