Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
852 changes: 700 additions & 152 deletions src/lerobot/processor/pipeline.py

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion tests/processor/test_act_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ def test_act_processor_save_and_load():
preprocessor.save_pretrained(tmpdir)

# Load preprocessor
loaded_preprocessor = DataProcessorPipeline.from_pretrained(tmpdir)
loaded_preprocessor = DataProcessorPipeline.from_pretrained(
tmpdir, config_filename="policy_preprocessor.json"
)

# Test that loaded processor works
observation = {OBS_STATE: torch.randn(7)}
Expand Down
10 changes: 8 additions & 2 deletions tests/processor/test_batch_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@ def test_save_and_load_pretrained():

# Load pipeline
loaded_pipeline = DataProcessorPipeline.from_pretrained(
tmp_dir, to_transition=identity_transition, to_output=identity_transition
tmp_dir,
config_filename="batchpipeline.json",
to_transition=identity_transition,
to_output=identity_transition,
)

assert loaded_pipeline.name == "BatchPipeline"
Expand Down Expand Up @@ -325,7 +328,10 @@ def test_registry_based_save_load():
with tempfile.TemporaryDirectory() as tmp_dir:
pipeline.save_pretrained(tmp_dir)
loaded_pipeline = DataProcessorPipeline.from_pretrained(
tmp_dir, to_transition=identity_transition, to_output=identity_transition
tmp_dir,
config_filename="dataprocessorpipeline.json",
to_transition=identity_transition,
to_output=identity_transition,
)

# Verify the loaded processor works
Expand Down
4 changes: 3 additions & 1 deletion tests/processor/test_classifier_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ def test_classifier_processor_save_and_load():
preprocessor.save_pretrained(tmpdir)

# Load preprocessor
loaded_preprocessor = DataProcessorPipeline.from_pretrained(tmpdir)
loaded_preprocessor = DataProcessorPipeline.from_pretrained(
tmpdir, config_filename="classifier_preprocessor.json"
)

# Test that loaded processor works
observation = {
Expand Down
4 changes: 3 additions & 1 deletion tests/processor/test_device_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ def test_save_and_load_pretrained():
robot_processor.save_pretrained(tmpdir)

# Load
loaded_processor = DataProcessorPipeline.from_pretrained(tmpdir)
loaded_processor = DataProcessorPipeline.from_pretrained(
tmpdir, config_filename="device_test_processor.json"
)

assert len(loaded_processor.steps) == 1
loaded_device_processor = loaded_processor.steps[0]
Expand Down
4 changes: 3 additions & 1 deletion tests/processor/test_diffusion_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ def test_diffusion_processor_save_and_load():
preprocessor.save_pretrained(tmpdir)

# Load preprocessor
loaded_preprocessor = DataProcessorPipeline.from_pretrained(tmpdir)
loaded_preprocessor = DataProcessorPipeline.from_pretrained(
tmpdir, config_filename="policy_preprocessor.json"
)

# Test that loaded processor works
observation = {
Expand Down
Loading