Skip to content

Commit cf839bd

Browse files
Cadenealiberts
authored andcommitted
Fix missing local_files_only in record/replay (huggingface#540)
Co-authored-by: Simon Alibert <alibert.sim@gmail.com>
1 parent b98b60f commit cf839bd

File tree

3 files changed

+51
-39
lines changed

3 files changed

+51
-39
lines changed

.github/workflows/test.yml

+35-35
Original file line numberDiff line numberDiff line change
@@ -102,38 +102,38 @@ jobs:
102102
&& rm -rf tests/outputs outputs
103103
104104
# TODO(aliberts, rcadene): redesign after v2 migration / removing hydra
105-
end-to-end:
106-
name: End-to-end
107-
runs-on: ubuntu-latest
108-
env:
109-
MUJOCO_GL: egl
110-
steps:
111-
- uses: actions/checkout@v4
112-
with:
113-
lfs: true # Ensure LFS files are pulled
114-
115-
- name: Install apt dependencies
116-
# portaudio19-dev is needed to install pyaudio
117-
run: |
118-
sudo apt-get update && \
119-
sudo apt-get install -y libegl1-mesa-dev portaudio19-dev
120-
121-
- name: Install poetry
122-
run: |
123-
pipx install poetry && poetry config virtualenvs.in-project true
124-
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
125-
126-
- name: Set up Python 3.10
127-
uses: actions/setup-python@v5
128-
with:
129-
python-version: "3.10"
130-
cache: "poetry"
131-
132-
- name: Install poetry dependencies
133-
run: |
134-
poetry install --all-extras
135-
136-
- name: Test end-to-end
137-
run: |
138-
make test-end-to-end \
139-
&& rm -rf outputs
105+
# end-to-end:
106+
# name: End-to-end
107+
# runs-on: ubuntu-latest
108+
# env:
109+
# MUJOCO_GL: egl
110+
# steps:
111+
# - uses: actions/checkout@v4
112+
# with:
113+
# lfs: true # Ensure LFS files are pulled
114+
115+
# - name: Install apt dependencies
116+
# # portaudio19-dev is needed to install pyaudio
117+
# run: |
118+
# sudo apt-get update && \
119+
# sudo apt-get install -y libegl1-mesa-dev portaudio19-dev
120+
121+
# - name: Install poetry
122+
# run: |
123+
# pipx install poetry && poetry config virtualenvs.in-project true
124+
# echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
125+
126+
# - name: Set up Python 3.10
127+
# uses: actions/setup-python@v5
128+
# with:
129+
# python-version: "3.10"
130+
# cache: "poetry"
131+
132+
# - name: Install poetry dependencies
133+
# run: |
134+
# poetry install --all-extras
135+
136+
# - name: Test end-to-end
137+
# run: |
138+
# make test-end-to-end \
139+
# && rm -rf outputs

lerobot/scripts/control_robot.py

+15-3
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def replay(
341341
episode: int,
342342
fps: int | None = None,
343343
play_sounds: bool = True,
344-
local_files_only: bool = True,
344+
local_files_only: bool = False,
345345
):
346346
# TODO(rcadene, aliberts): refactor with control_loop, once `dataset` is an instance of LeRobotDataset
347347
# TODO(rcadene): Add option to record logs
@@ -424,14 +424,20 @@ def replay(
424424
"--root",
425425
type=Path,
426426
default=None,
427-
help="Root directory where the dataset will be stored locally at '{root}/{repo_id}' (e.g. 'data/hf_username/dataset_name').",
427+
help="Root directory where the dataset will be stored (e.g. 'dataset/path').",
428428
)
429429
parser_record.add_argument(
430430
"--repo-id",
431431
type=str,
432432
default="lerobot/test",
433433
help="Dataset identifier. By convention it should match '{hf_username}/{dataset_name}' (e.g. `lerobot/test`).",
434434
)
435+
parser_record.add_argument(
436+
"--local-files-only",
437+
type=int,
438+
default=0,
439+
help="Use local files only. By default, this script will try to fetch the dataset from the hub if it exists.",
440+
)
435441
parser_record.add_argument(
436442
"--warmup-time-s",
437443
type=int,
@@ -520,14 +526,20 @@ def replay(
520526
"--root",
521527
type=Path,
522528
default=None,
523-
help="Root directory where the dataset will be stored locally at '{root}/{repo_id}' (e.g. 'data/hf_username/dataset_name').",
529+
help="Root directory where the dataset will be stored (e.g. 'dataset/path').",
524530
)
525531
parser_replay.add_argument(
526532
"--repo-id",
527533
type=str,
528534
default="lerobot/test",
529535
help="Dataset identifier. By convention it should match '{hf_username}/{dataset_name}' (e.g. `lerobot/test`).",
530536
)
537+
parser_replay.add_argument(
538+
"--local-files-only",
539+
type=int,
540+
default=0,
541+
help="Use local files only. By default, this script will try to fetch the dataset from the hub if it exists.",
542+
)
531543
parser_replay.add_argument("--episode", type=int, default=0, help="Index of the episode to replay.")
532544

533545
args = parser.parse_args()

tests/test_control_robot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def test_record_and_replay_and_policy(tmpdir, request, robot_type, mock):
158158
assert dataset.meta.total_episodes == 2
159159
assert len(dataset) == 2
160160

161-
replay(robot, episode=0, fps=1, root=root, repo_id=repo_id, play_sounds=False)
161+
replay(robot, episode=0, fps=1, root=root, repo_id=repo_id, play_sounds=False, local_files_only=True)
162162

163163
# TODO(rcadene, aliberts): rethink this design
164164
if robot_type == "aloha":

0 commit comments

Comments
 (0)