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
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ jobs:
- run: python -m pip install build twine
- run: python -m build --outdir dist packages/metasim && python -m build --outdir dist .
- run: python -m twine check --strict dist/*
- name: The wheels carry what the benchmark needs (instance sets, manifests, notices)
run: python tools/release/wheel_check.py dist/*.whl
- name: Extract this version's CHANGELOG sections as the release notes
env:
VERSION: ${{ steps.ver.outputs.version }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0 # the leaderboard gate asks whether a submission's commit exists here
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7
with:
python-version: "3.11"
Expand Down Expand Up @@ -167,6 +169,8 @@ jobs:
python tools/release/changelog_check.py --version "$v"
- run: python -m build --outdir dist packages/metasim && python -m build --outdir dist .
- run: python -m twine check --strict dist/*
- name: The wheels carry what the benchmark needs (instance sets, manifests, notices)
run: python tools/release/wheel_check.py dist/*.whl

lock:
# The benchmark environment lock (requirements/bench-cpu.lock.txt) is what the evaluation image installs;
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ release.
## [Unreleased]

### Added
- `tools/release/wheel_check.py` (run after every build in CI and on the tag path) asserts the built wheels carry what the benchmark needs: the suite instance sets and their sidecars, the suite manifests, `metasim.toml`'s content roots, the NOTICE files. The first build after the instance sets landed shipped the sidecars but not the sets (`*.json.gz` was not package data), which this would have caught.
- `tools/bench/freeze_instances.py` records each set's `instance_pool_hash` in the sidecar, which the submission gate compares against; `tools/bench/leaderboard.py` refuses a row whose recorded commit is not on main's history (nobody could check it out to re-run it).
- The tabletop-mujoco suite scores each task on a frozen instance set shipped with the repository (`roboverse_pack/suites/instances/tabletop-mujoco/<task>/franka_v2.json.gz`, 50 instances, one per protocol episode): the first published instances whose initial state is inside the joint limits and whose reference demo replays on MuJoCo, written by `tools/bench/freeze_instances.py` with a sidecar that names the source file and every skipped instance. This replaces the Hub demo files as the scoring set (the shipped lift_peg_upright start was unphysical; pick_cube's demos replayed at 0.8) and is hashed in the suite manifest.

## [1.0.0] - 2026-11-30
Expand Down
120 changes: 60 additions & 60 deletions docs/source/dataset_benchmark/benchmark/leaderboard.md

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions docs/source/dataset_benchmark/benchmark/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ release stands behind and opens an issue on a red night.
4. Commit `results/tabletop-mujoco/<name>/`, run `python tools/bench/leaderboard.py`, open a pull request.

The generator refuses a row that cannot be re-run from its file: the suite's protocol on the suite's
backend, a clean commit, the recorded command, the instance-pool hash and the policy's weights (a
checkpoint URL and hash, or a served policy's checkpoint or model revision) are all required. A submission
backend with `num_envs=1`, a clean commit on main's history, the recorded command, the suite's
instance set with the instance-pool hash its sidecar records, an access tier that is a preset (or carries its
own name), and the policy's weights (a checkpoint URL and hash, or a served policy's checkpoint or model
revision) are all required. A submission
that cannot meet that carries a `PROVISIONAL.md` saying why and is listed apart, never pooled or ranked.
A submission is re-run from its files alone, weekly on CI inside the evaluation image or by anyone with
`python tools/bench/verify_submission.py results/<suite>/<name> --write`; the outcome (`reproduced`, `partial`
Expand Down
2 changes: 2 additions & 0 deletions packages/metasim/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- The wheel ships a `NOTICE` (Apache-2.0 §4(d)) naming the Isaac Lab and HandsOn code it includes, next to `LICENSE.isaaclab` and `LICENSE.handson`; `tools/release/wheel_check.py` requires it.
- `submission_problems` also refuses a result whose `notes.instance_pool_hash` is not the hash recorded in the suite instance set's sidecar (`metasim.bench.instance_set_hash`; the episodes did not run on the set), a result with `num_envs != 1` (a suite's official protocol), and an access profile that borrows a preset's name but differs from it.
- `SuiteTask.demos`: the instance set a suite scores a task on, a repository-relative demo file that `bench suite run` applies in both execution modes and records as `notes.demos`; `submission_problems` refuses a result scored on anything else (or on a `--demos` override the suite does not define). `metasim.utils.demo_util` reads and writes `.json.gz` trajectory files (gzip JSON: readable, no pickle), the format the repository's instance sets use.

## [1.0.0] - 2026-11-30
Expand Down
13 changes: 13 additions & 0 deletions packages/metasim/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
MetaSim (roboverse-metasim)
Copyright (c) 2024-2026 The RoboVerse Contributors

This product includes software developed by third parties, used under their own
licenses. The authoritative index of that software (the path in the repository,
the upstream project, its license, and whether the code was vendored or adapted)
is THIRD_PARTY_NOTICES.md at the root of the RoboVerse repository
(https://github.com/RoboVerseOrg/RoboVerse).

Third-party code included in this distribution:

Isaac Lab (BSD-3-Clause) - github.com/isaac-sim/IsaacLab - see LICENSE.isaaclab
HandsOn (MIT) - see LICENSE.handson
2 changes: 2 additions & 0 deletions packages/metasim/metasim/bench/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
BenchmarkSuite,
SuiteTask,
get_suite,
instance_set_hash,
list_suites,
manifest_problems,
register_suite,
Expand Down Expand Up @@ -105,6 +106,7 @@
"get_suite",
"hash_state",
"instance_pool",
"instance_set_hash",
"list_suites",
"load_policy",
"manifest_problems",
Expand Down
45 changes: 44 additions & 1 deletion packages/metasim/metasim/bench/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from loguru import logger as log

from .access import AccessProfile
from .access import ACCESS_PROFILES, AccessProfile
from .protocol import EvalProtocol
from .result import BenchmarkResult, wilson_interval

Expand Down Expand Up @@ -251,6 +251,27 @@ def manifest_problems(result: BenchmarkResult, suite: BenchmarkSuite) -> list[st
return problems


def instance_set_hash(demos: str) -> str | None:
"""The ``instance_pool_hash`` recorded in the sidecar of a suite's instance set, or None when it has none.

``tools/bench/freeze_instances.py`` writes ``<set>.json`` next to the set with the fingerprint ``evaluate`` computes
on it, so a result's ``notes.instance_pool_hash`` can be checked without loading the set into a simulator. The
path is repository-relative, so the check needs the repository root as the working directory (as every asset
path does).
"""
import json
from pathlib import Path

sidecar = Path(f"{demos}.json")
if not sidecar.is_file():
return None
try:
value = json.loads(sidecar.read_text()).get("instance_pool_hash")
except (OSError, ValueError):
return None
return str(value) if value else None


LEARNED_FAMILIES = ("il", "rl", "vla")
"""Policy families whose number depends on weights: a submission must say where those weights are."""

Expand Down Expand Up @@ -309,6 +330,28 @@ def submission_problems(result: BenchmarkResult, suite: BenchmarkSuite) -> list[
)
elif entry is not None and not entry.demos and scored_on:
problems.append(f"scored on a --demos override ({scored_on}) the suite does not define for {result.task!r}")
expected_hash = instance_set_hash(entry.demos) if entry is not None and entry.demos else None
if expected_hash and notes.get("instance_pool_hash") and notes["instance_pool_hash"] != expected_hash:
problems.append(
f"notes.instance_pool_hash {str(notes['instance_pool_hash'])[:12]} is not the hash of the suite's instance "
f"set ({expected_hash[:12]}, from {entry.demos}.json): the episodes did not run on the set"
)
if result.num_envs != 1:
problems.append(
f"run with num_envs={result.num_envs}; a suite's official protocol is num_envs=1 (a handler seeds a batch "
"at once, so another batch size is another draw of randomness)"
)
access = result.protocol.get("access") if isinstance(result.protocol, dict) else None
if isinstance(access, dict) and access.get("name") in ACCESS_PROFILES:
try:
claimed = AccessProfile.from_dict(access)
except (TypeError, ValueError):
claimed = None
if claimed is not None and claimed.to_dict() != ACCESS_PROFILES[access["name"]].to_dict():
problems.append(
f"the access profile is named {access['name']!r} but differs from that preset; a leaderboard column "
"is one preset, a custom profile needs its own name"
)
if notes.get("instance_problems"):
problems.append(
f"{len(notes['instance_problems'])} instance(s) start outside the robot's joint limits "
Expand Down
33 changes: 33 additions & 0 deletions packages/metasim/metasim/test/test_bench_suites_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,3 +1112,36 @@ def test_gzip_json_is_a_trajectory_format(tmp_path):
assert load_traj_file(str(folder / "bot_v2.json.gz")) == data
assert _resolve_traj_file(str(folder), "bot") == str(folder / "bot_v2.json.gz")
assert (folder / "bot_v2.json.gz").read_bytes()[:2] == b"\x1f\x8b", "gzip, not a pickle"


def test_submission_gate_checks_the_set_hash_the_batch_size_and_preset_tiers(tmp_path, monkeypatch):
"""A row that claims the suite's instance set must carry its pool hash; batches and renamed presets are refused."""
import json

from metasim.bench import ACCESS_PROFILES, SuiteTask, instance_set_hash, submission_problems

demos = "roboverse_pack/suites/instances/pinned/t/bot_v2.json.gz"
pinned = BenchmarkSuite(name="pinned", splits={"core": (SuiteTask("t", demos=demos),)}, simulator="fake")
monkeypatch.chdir(tmp_path) # sidecars are repository-relative, like every asset path
assert instance_set_hash(demos) is None, "no sidecar, nothing to compare against"
sidecar = tmp_path / (demos + ".json")
sidecar.parent.mkdir(parents=True)
sidecar.write_text(json.dumps({"count": 1, "instance_pool_hash": "a" * 64}))
assert instance_set_hash(demos) == "a" * 64
result = _result("t", 1, 1)
result.notes["demos"] = {"path": demos, "sha256": "b" * 64}
result.notes["instance_pool_hash"] = "a" * 64
assert not any("did not run on the set" in p for p in submission_problems(result, pinned))
result.notes["instance_pool_hash"] = "c" * 64
assert any("the episodes did not run on the set" in p for p in submission_problems(result, pinned))
result.notes["instance_pool_hash"] = "a" * 64
result.num_envs = 4
assert any(
"num_envs=4" in p and "official protocol is num_envs=1" in p for p in submission_problems(result, pinned)
)
result.num_envs = 1
visual = ACCESS_PROFILES["visual"].to_dict()
result.protocol["access"] = visual
assert not any("differs from that preset" in p for p in submission_problems(result, pinned))
result.protocol["access"] = {**visual, "observation": "privileged"} # a "visual" tier that sees everything
assert any("named 'visual' but differs from that preset" in p for p in submission_problems(result, pinned))
4 changes: 4 additions & 0 deletions packages/metasim/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ extend-exclude = [
"docker"
]

[tool.setuptools]
# Apache-2.0 §4(d): the NOTICE travels with every distribution; the vendored upstream licenses ship next to it.
license-files = ["LICENSE", "LICENSE.*", "NOTICE"]

[tool.setuptools.packages.find]
include = ["metasim", "metasim.*"]

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ roboverse_pack = [
"**/*.xml",
"**/*.yaml",
"**/*.hdr",
"**/*.json", # LIBERO native bundles + task metadata
"**/*.json", # LIBERO native bundles + task metadata, suite manifests and instance-set sidecars
"**/*.json.gz", # the benchmark instance sets (roboverse_pack/suites/instances): a wheel without them cannot score a suite
"**/*.npz", # LIBERO native_bundles_plus initial states
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@
"sha256": "141be78c36a059ebd49fa42dce9970d081db101bc3092d3a4e03f1c69f58ee47",
"bytes": 663657
},
"instance_pool_hash": "10495d67ad381ebb142e14ea66442ec6d6491ec2fbe30d18d7083256e736989d",
"frozen": "2026-11-30"
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,6 @@
"sha256": "693b2e4a8b524bf9e011be8d284aea00d79c9b1805bb92108cfadf85815696ac",
"bytes": 376314
},
"instance_pool_hash": "030066265cb5a27ff331f3412af87d16f38cb6506643a95a4d9f3c7daf8d6fd7",
"frozen": "2026-11-30"
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@
"sha256": "f641bea238a2af5b542cd6668be7d1dfaceca689f1553b94699c6c7f33b103d3",
"bytes": 271951
},
"instance_pool_hash": "cf1e2c8cf8d2b45af2b391d55d2ef50bf141b01add86b63ed8094f1b9463c025",
"frozen": "2026-11-30"
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@
"sha256": "c3d7a472263261fd2258577c9a3c14c479f2c479b387492be3a32bee6783faf7",
"bytes": 243220
},
"instance_pool_hash": "6ccc076c56c9f8d0c75d57a6adf11849a99b92ec573f0396bbbc00cddaef3f84",
"frozen": "2026-11-30"
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@
"sha256": "cf5f77a41d45e3d4eb93fc39a9a59d5b204949d24ff177b552b203f0374cdcab",
"bytes": 487771
},
"instance_pool_hash": "7768bfd91cb30b4c4a18a8a94f045d2e8f0faad25f889f29c7bbc8f705987c28",
"frozen": "2026-11-30"
}
29 changes: 27 additions & 2 deletions tests/test_leaderboard_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,25 @@ def gen(monkeypatch, tmp_path):
spec.loader.exec_module(module)
monkeypatch.setattr(module, "RESULTS", tmp_path / "results")
monkeypatch.setattr(module, "PAGE", tmp_path / "leaderboard.md")
real_commit_known = module.commit_known
monkeypatch.setattr(
module, "commit_known", lambda sha, **kw: sha == "abcdef0123456789" or real_commit_known(sha, **kw)
)
return module


def test_a_row_at_a_commit_this_repository_does_not_have_is_refused(gen, tmp_path):
import subprocess

head = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True, check=True).stdout.strip()
assert gen.commit_known(head) and not gen.commit_known("0" * 40)
assert gen.commit_known("0" * 40, repo=tmp_path), "outside a repository there is nothing to check against"
sub = tmp_path / "results" / SUITE / "2026-12-01-x"
_result("pick_cube", "replay", (True,), commit="0" * 40).save(sub / "r.json")
with pytest.raises(ValueError, match="is not on this branch's history"):
gen.load_all()


def _result(
task: str,
policy: str,
Expand All @@ -47,7 +63,15 @@ def _result(
commit: str = "abcdef0123456789",
):
"""A result as ``bench suite run`` writes it for the tabletop-mujoco suite: reproducible unless told otherwise."""
from metasim.bench import AccessProfile, BenchmarkResult, EpisodeResult, EvalProtocol, get_access_profile, get_suite
from metasim.bench import (
AccessProfile,
BenchmarkResult,
EpisodeResult,
EvalProtocol,
get_access_profile,
get_suite,
instance_set_hash,
)

manifest = get_suite(SUITE).manifest or {"assets": {}, "tasks": {}, "hub_revision": None}
robot_asset = "roboverse_data/robots/franka/mjcf/panda.xml"
Expand Down Expand Up @@ -87,7 +111,8 @@ def _result(
"access": access,
"success_defined": True,
"command": COMMAND,
"instance_pool_hash": "ab" * 32,
# the hash the evaluator computes on the suite's instance set (the gate compares against the sidecar's)
"instance_pool_hash": (instance_set_hash(demo_path) if demo_path else None) or "ab" * 32,
**({"demo_file": demo_file} if demo_file else {}),
**({"demos": demo_file} if demo_file else {}), # the suite's instance set, as `bench suite run` records it
**({"suite": {"name": SUITE, "split": "core"}} if tagged else {}),
Expand Down
42 changes: 42 additions & 0 deletions tests/test_release_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,45 @@ def test_the_committed_changelogs_name_the_pyproject_version():
sys.modules[spec.name] = module
spec.loader.exec_module(module)
assert module.main(["--version", version]) == 0


def test_wheel_check_names_missing_and_stray_files(tmp_path, capsys):
"""``tools/release/wheel_check.py``: a wheel without the instance sets, or with tests inside, fails with the pattern named."""
import zipfile

spec = importlib.util.spec_from_file_location(
"wheel_check", Path(__file__).resolve().parents[1] / "tools" / "release" / "wheel_check.py"
)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)

def wheel(name, files):
path = tmp_path / name
with zipfile.ZipFile(path, "w") as z:
for f in files:
z.writestr(f, "x")
return path

complete = [
"roboverse_pack/suites/__init__.py",
"roboverse_pack/suites/manifests/s.json",
"roboverse_pack/suites/instances/s/t/bot_v2.json.gz",
"roboverse_pack/suites/instances/s/t/bot_v2.json.gz.json",
"roboverse_pack/tasks/x/y.py",
"roboverse_pack/robots/y.py",
"roboverse_py-1.0.0.dist-info/licenses/NOTICE",
"roboverse_py-1.0.0.dist-info/licenses/THIRD_PARTY_NOTICES.md",
]
good = wheel("roboverse_py-1.0.0-py3-none-any.whl", complete)
assert module.check(good) == []
assert module.main([str(good)]) == 0 and "carry what the benchmark needs" in capsys.readouterr().out
without_sets = wheel("roboverse_py-1.0.1-py3-none-any.whl", [f for f in complete if not f.endswith(".json.gz")])
(problem,) = module.check(without_sets)
assert "*_v2.json.gz'" in problem and "package-data" in problem
stray = wheel("roboverse_py-1.0.2-py3-none-any.whl", [*complete, "tests/test_x.py", "results/s/r.json"])
problems = module.check(stray)
assert len(problems) == 2 and all("do not belong in a wheel" in p for p in problems)
assert module.check(wheel("other-1.0-py3-none-any.whl", [])) == [
"other-1.0-py3-none-any.whl: unknown distribution 'other'; add its required contents to wheel_check.py"
]
assert module.main([]) == 2
1 change: 1 addition & 0 deletions tests/test_suites.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def test_every_suite_task_ships_its_instance_set(name):
demos = data[robot]
assert len(demos) == sidecar["count"] == suite.protocol_for(entry).episodes, "one instance per protocol episode"
assert sidecar["file"]["path"] == entry.demos and sidecar["source"]["sha256"]
assert len(sidecar.get("instance_pool_hash") or "") == 64, "the gate compares results against this hash"
assert len(sidecar["kept_source_indices"]) == len(demos)
cls = get_task_class(entry.task)
limits = {r.name: (r.joint_limits or {}) for r in cls.scenario.robots}
Expand Down
12 changes: 12 additions & 0 deletions tools/bench/freeze_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,17 @@ def freeze_task(
target = out / suite.name / entry.task / f"{robot}_v2.json.gz"
target.parent.mkdir(parents=True, exist_ok=True)
save_traj_file({robot: [d for _, d in kept]}, str(target))
# the fingerprint `evaluate` writes into notes.instance_pool_hash for this set: the gate compares against it, so a
# result that claims the set but ran on other instances is caught
from metasim.bench import pool_fingerprint

env = cls(scenario, device)
try:
env.traj_filepath = target.relative_to(REPO).as_posix() if target.is_relative_to(REPO) else str(target)
env.__dict__.pop("_bench_instance_pool", None)
pool_hash = pool_fingerprint(instance_pool(env))
finally:
env.close()
record = {
"suite": suite.name,
"task": entry.task,
Expand All @@ -176,6 +187,7 @@ def freeze_task(
"sha256": _sha256(target),
"bytes": target.stat().st_size,
},
"instance_pool_hash": pool_hash,
"frozen": datetime.now(timezone.utc).strftime("%Y-%m-%d"),
}
target.with_name(target.name + ".json").write_text(json.dumps(record, indent=2) + "\n")
Expand Down
Loading
Loading