Skip to content

Commit c4f2c13

Browse files
kevinzakkacopybara-github
authored andcommitted
Ensure we check out a specific commit of Menagerie. Fixes #20.
PiperOrigin-RevId: 716748884 Change-Id: I39dbae49c48fe2875b30fc5c0063ca7c5da68701
1 parent 24c16ee commit c4f2c13

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

mujoco_playground/_src/mjx_env.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@
3636
# The menagerie path is used to load robot assets.
3737
# Resource paths do not have glob implemented, so we use a bare epath.Path.
3838
MENAGERIE_PATH = EXTERNAL_DEPS_PATH / "mujoco_menagerie"
39+
# Commit SHA of the menagerie repo.
40+
MENAGERIE_COMMIT_SHA = "5e6af47a49bf8ae27581615b54045107b20ce584"
3941

4042

41-
def _clone_with_progress(repo_url: str, target_path: str) -> None:
43+
def _clone_with_progress(
44+
repo_url: str, target_path: str, commit_sha: str
45+
) -> None:
4246
"""Clone a git repo with progress bar."""
4347
process = subprocess.Popen(
4448
["git", "clone", "--progress", repo_url, target_path],
@@ -75,6 +79,15 @@ def _clone_with_progress(repo_url: str, target_path: str) -> None:
7579
if process.returncode != 0:
7680
raise subprocess.CalledProcessError(process.returncode, ["git", "clone"])
7781

82+
# Checkout specific commit.
83+
print(f"Checking out commit {commit_sha}")
84+
subprocess.run(
85+
["git", "-C", target_path, "checkout", commit_sha],
86+
check=True,
87+
stdout=subprocess.PIPE,
88+
stderr=subprocess.PIPE,
89+
)
90+
7891

7992
def ensure_menagerie_exists() -> None:
8093
"""Ensure mujoco_menagerie exists, downloading it if necessary."""
@@ -88,6 +101,7 @@ def ensure_menagerie_exists() -> None:
88101
_clone_with_progress(
89102
"https://github.com/deepmind/mujoco_menagerie.git",
90103
str(MENAGERIE_PATH),
104+
MENAGERIE_COMMIT_SHA,
91105
)
92106
print("Successfully downloaded mujoco_menagerie")
93107
except subprocess.CalledProcessError as e:

0 commit comments

Comments
 (0)