Fix missing local_files_only in record/replay (#540)

Co-authored-by: Simon Alibert <alibert.sim@gmail.com>
This commit is contained in:
Remi 2024-12-03 10:53:21 +01:00 committed by GitHub
parent a2c181992a
commit 286bca37cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 46 additions and 34 deletions

View File

@ -102,38 +102,38 @@ jobs:
&& rm -rf tests/outputs outputs && rm -rf tests/outputs outputs
# TODO(aliberts, rcadene): redesign after v2 migration / removing hydra # TODO(aliberts, rcadene): redesign after v2 migration / removing hydra
end-to-end: # end-to-end:
name: End-to-end # name: End-to-end
runs-on: ubuntu-latest # runs-on: ubuntu-latest
env: # env:
MUJOCO_GL: egl # MUJOCO_GL: egl
steps: # steps:
- uses: actions/checkout@v4 # - uses: actions/checkout@v4
with: # with:
lfs: true # Ensure LFS files are pulled # lfs: true # Ensure LFS files are pulled
- name: Install apt dependencies # - name: Install apt dependencies
# portaudio19-dev is needed to install pyaudio # # portaudio19-dev is needed to install pyaudio
run: | # run: |
sudo apt-get update && \ # sudo apt-get update && \
sudo apt-get install -y libegl1-mesa-dev portaudio19-dev # sudo apt-get install -y libegl1-mesa-dev portaudio19-dev
- name: Install poetry # - name: Install poetry
run: | # run: |
pipx install poetry && poetry config virtualenvs.in-project true # pipx install poetry && poetry config virtualenvs.in-project true
echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH # echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH
- name: Set up Python 3.10 # - name: Set up Python 3.10
uses: actions/setup-python@v5 # uses: actions/setup-python@v5
with: # with:
python-version: "3.10" # python-version: "3.10"
cache: "poetry" # cache: "poetry"
- name: Install poetry dependencies # - name: Install poetry dependencies
run: | # run: |
poetry install --all-extras # poetry install --all-extras
- name: Test end-to-end # - name: Test end-to-end
run: | # run: |
make test-end-to-end \ # make test-end-to-end \
&& rm -rf outputs # && rm -rf outputs

View File

@ -341,7 +341,7 @@ def replay(
episode: int, episode: int,
fps: int | None = None, fps: int | None = None,
play_sounds: bool = True, play_sounds: bool = True,
local_files_only: bool = True, local_files_only: bool = False,
): ):
# TODO(rcadene, aliberts): refactor with control_loop, once `dataset` is an instance of LeRobotDataset # TODO(rcadene, aliberts): refactor with control_loop, once `dataset` is an instance of LeRobotDataset
# TODO(rcadene): Add option to record logs # TODO(rcadene): Add option to record logs
@ -424,7 +424,7 @@ if __name__ == "__main__":
"--root", "--root",
type=Path, type=Path,
default=None, default=None,
help="Root directory where the dataset will be stored locally at '{root}/{repo_id}' (e.g. 'data/hf_username/dataset_name').", help="Root directory where the dataset will be stored (e.g. 'dataset/path').",
) )
parser_record.add_argument( parser_record.add_argument(
"--repo-id", "--repo-id",
@ -432,6 +432,12 @@ if __name__ == "__main__":
default="lerobot/test", default="lerobot/test",
help="Dataset identifier. By convention it should match '{hf_username}/{dataset_name}' (e.g. `lerobot/test`).", help="Dataset identifier. By convention it should match '{hf_username}/{dataset_name}' (e.g. `lerobot/test`).",
) )
parser_record.add_argument(
"--local-files-only",
type=int,
default=0,
help="Use local files only. By default, this script will try to fetch the dataset from the hub if it exists.",
)
parser_record.add_argument( parser_record.add_argument(
"--warmup-time-s", "--warmup-time-s",
type=int, type=int,
@ -520,7 +526,7 @@ if __name__ == "__main__":
"--root", "--root",
type=Path, type=Path,
default=None, default=None,
help="Root directory where the dataset will be stored locally at '{root}/{repo_id}' (e.g. 'data/hf_username/dataset_name').", help="Root directory where the dataset will be stored (e.g. 'dataset/path').",
) )
parser_replay.add_argument( parser_replay.add_argument(
"--repo-id", "--repo-id",
@ -528,6 +534,12 @@ if __name__ == "__main__":
default="lerobot/test", default="lerobot/test",
help="Dataset identifier. By convention it should match '{hf_username}/{dataset_name}' (e.g. `lerobot/test`).", help="Dataset identifier. By convention it should match '{hf_username}/{dataset_name}' (e.g. `lerobot/test`).",
) )
parser_replay.add_argument(
"--local-files-only",
type=int,
default=0,
help="Use local files only. By default, this script will try to fetch the dataset from the hub if it exists.",
)
parser_replay.add_argument("--episode", type=int, default=0, help="Index of the episode to replay.") parser_replay.add_argument("--episode", type=int, default=0, help="Index of the episode to replay.")
args = parser.parse_args() args = parser.parse_args()

View File

@ -158,7 +158,7 @@ def test_record_and_replay_and_policy(tmpdir, request, robot_type, mock):
assert dataset.meta.total_episodes == 2 assert dataset.meta.total_episodes == 2
assert len(dataset) == 2 assert len(dataset) == 2
replay(robot, episode=0, fps=1, root=root, repo_id=repo_id, play_sounds=False) replay(robot, episode=0, fps=1, root=root, repo_id=repo_id, play_sounds=False, local_files_only=True)
# TODO(rcadene, aliberts): rethink this design # TODO(rcadene, aliberts): rethink this design
if robot_type == "aloha": if robot_type == "aloha":