Datasets:
|
Download source/docs/generation.md from AndyZ2001/mingru-mojoco-runs: direct link, hf CLI and curl.
- Browser
- Download file 17.3 kB
-
https://huggingface.co/datasets/AndyZ2001/mingru-mojoco-runs/resolve/main/source/docs/generation.md
- Command line
-
hf download hf://datasets/AndyZ2001/mingru-mojoco-runs/source/docs/generation.md
-
curl -L -o generation.md https://huggingface.co/datasets/AndyZ2001/mingru-mojoco-runs/resolve/main/source/docs/generation.md
17.3 kB
| # Generation | |
| An agent (a coding CLI and a model) rebuilds one benchmark item, a room, an object or a demonstration's scene, in Docker, | |
| from the item's public input, under the contract of its track and engine. Code: `src/simready/generation/`. | |
| - `contracts.py`: the eight contracts, the images, the CLIs, the egress hosts, prompt rendering. | |
| - `prompts/`: every word an agent is told (`{{name}}` placeholders, filled per item and budget; `image_tools.json` swaps | |
| Claude's "Read tool" for Codex's and OpenCode's own image tool; `resume.md` is the message of each later budget). | |
| - `stage.py`: the agent's snapshot of `data/benchmark/<track>/<id>/input`, anonymised by `anonymize.py`. | |
| - `session.py`: one isolated session over one or more budgets; `cost.py`: tokens and money; `campaign.py`: job lists. | |
| - `runtime/`: the two Dockerfiles, the pinned Blender and OpenCode installers, the egress proxy, the MuJoCo room | |
| self-check and the Isaac Sim SDK example. | |
| ## Contracts | |
| A contract has a name and no version. Its identity is `contract.sha256` in run.json: the hash of its record, every prompt | |
| file it renders and every file it stages into the container. Change any of them and the hash changes. | |
| | Contract | Given (`/work/input`, read-only) | Tools (`/work/tools`, read-only) | Output (`/work/output`) | Self-check | | |
| |---|---|---|---|---| | |
| | `scenes-mujoco` | `video.mp4`, `scale_anchor.json`, `anchor_reference.png`, `anchor_marked.png`, `prompt.txt`, `generation_spec.json`, `self_check.py` | | `scene.xml`, `assets/`, `objects.json`, `README.md`, `refinement_log.json`, `previews/` | `python /work/input/self_check.py /work/output` (runtime/self_check_mujoco.py: passive limits, missing labels) | | |
| | `scenes-isaac` | as MuJoCo, plus `sdk_smoke.py` | | `scene.usda`, `build_scene.py`, `objects.json`, `render_preview.py`, `preview.mp4`, `interaction.mp4`, `README.md`, `refinement_log.json` | the evaluator's `isaac_physics.py` as `self_check.py` | | |
| | `objects-rigid-mujoco` | `object.json` (name, category), `photos/` | | `scene.xml` (body `object`, freejoint, ground), `assets/`, `objects.json`, `README.md` | none | | |
| | `objects-rigid-isaac` | as MuJoCo | | `scene.usda` (PhysX scene, box ground), `objects.json`, `README.md` | none | | |
| | `objects-deformable-mujoco` | `case.txt`, `object_facts.json`, `media_manifest.json`, `media/` | `check_package.py` (the evaluator's `deformable_admission.py`) | `scene.xml` with one `<flexcomp>` (`dof="full"`), `assets/` if needed, `README.md` | `python /work/tools/check_package.py /work/output 2d\|3d` | | |
| | `objects-deformable-isaac` | as MuJoCo | `check_package.py`, `deformable_inspect.py` (the evaluator's) | `scene.usda` (`/World/Object/Material`), `meta.json` | `/isaac-sim/python.sh /work/tools/check_package.py` | | |
| | `demos-mujoco` | `instruction.txt`, `ext1.mp4`, `ext2.mp4`, `timestamps.json`, `cameras.json` (both exterior poses and intrinsics) | `check_package.py`, `mjcf_facts.py`, `rules.py` (the evaluator's) | `scene.xml` (`moved`, `target`, `table`), `assets/`, `objects.json`, `README.md` | `python /work/tools/check_package.py` | | |
| | `demos-isaac` | as MuJoCo | `check_package.py`, `usd_facts.py`, `rules.py` | `scene.usda` (`/World/moved`, `/World/target`, `/World/table`), `objects.json`, `README.md` | `/isaac-sim/python.sh /work/tools/check_package.py` | | |
| Never mounted: the item's `groundtruth/` and `provenance/` (sizes, masses, scans, reference shapes, the wrist video and | |
| calibration, stereo, the robot log, end-state labels, a room's source tag), the frozen protocol (copied beside the run as | |
| `evaluator_protocol.json`), other runs. The evaluator files are staged byte for byte from `src/simready/evaluation/` | |
| (paths in STRUCTURE.md); a session refuses to start while one is missing. | |
| **What the prompts say.** Labels are free text (no class list). The room prompt says the anchor's real dimensions give | |
| every other size and distance (measure against it where both are visible, or scale a reconstruction to it). The | |
| demonstration prompt says its calibration is metric (a point seen by both cameras can be triangulated), and that if the | |
| object is put on the table itself, the table is the target: built once as `target`, no `table`, listed as | |
| `{"id": "target", "label": "table"}`. No prompt, spec or staged file names an evaluation, a score, a metric, a threshold, | |
| a held-out view, a replay, ground truth or the source dataset (tested). Room refinement: at least 3 | |
| render-critique-refine rounds, 6 reference views, 12 inspected frames, the last 90 s for validation. | |
| **Staging hides the source.** Videos are remuxed with no container or stream metadata (no re-encode, rotation kept, audio | |
| dropped); JPEG and PNG lose EXIF, comments and text chunks, losslessly. A room's anchor gets the id `scale_anchor` and | |
| neutral measurement wording. Case ids and translation notes are dropped from `object_facts.json` and | |
| `media_manifest.json`, whose hashes are recomputed for the staged media. Episode ids are never staged. Tests scan every | |
| staged file, name and media tag for a deny-list of dataset, device and lab names (`anonymize.SOURCE_WORDS`). | |
| **Budget.** The agent is told the first of the session's cumulative budgets (wall-clock seconds from container start, | |
| default 900). The runner kills the container at the deadline; the output as it stands is the result. Each later budget | |
| resumes the same CLI conversation for the rest of its time (`prompts/resume.md`) and is its own run (`continued_from`). | |
| ## Tools and network | |
| Every prompt: any tools, including web search, and the installed software, including Blender (`blender`); download | |
| nothing (no files, models, assets, datasets or packages); do not look up this item, its media or the dataset it comes | |
| from; do not read authentication files. | |
| - **Claude Code** (host `~/.local/bin/claude`, mounted read-only): every tool but `WebFetch`; `WebSearch` runs on | |
| Anthropic's side. `--claude-config-dir` picks the login folder (default `~/.claude`, e.g. `~/.claude-huan`). | |
| - **Codex CLI** 0.167.0 (Linux x64, installed in both images, pinned by archive and binary sha256 in | |
| `runtime/install_codex.sh`): `web_search="live"`, browser features off. Model `gpt-6.1-sol`. | |
| The runner copies only the host login (`~/.codex/auth.json`) into the session state, not the host executable. | |
| - **OpenCode** 1.19.5 (in both images, pinned by sha256 with the ripgrep its glob and grep tools need): | |
| `opencode run --pure --auto --format json -m opencode-go/<model>`; `webfetch` denied by its permission config, so not | |
| offered; `websearch` (Exa or Parallel) on. Its config, cache, login and session database live in the session's state | |
| folder (`XDG_*`); updates, the models.dev fetch, plugins, project config and Claude Code compatibility are off. | |
| On a V2 host, the runner exports only the model provider's active account with `opencode auth export <provider>`. | |
| It converts V2 API-key credentials into the V1 schema in the private temporary state folder. The host needs no | |
| `auth.json`; its database is neither mounted nor copied. Rotated credentials return through `opencode auth import` | |
| only if the exported account and credentials still match the initial login. A V1 host can still use its existing | |
| `~/.local/share/opencode/auth.json`. CLI credential output is captured and excluded from errors and run logs. | |
| - **Isolation.** Read-only input and tools, writable output and scratch, the login copied into a private state folder and | |
| saved back when it rotates (a backup first; a login changed meanwhile by someone else is kept). Every 20 s a running | |
| session exchanges rotated tokens with the saved login, so sessions sharing a login do not invalidate each other. | |
| MuJoCo containers are read-only, non-root, 4 CPUs, 12 GB; Isaac containers one GPU, uid 1234, 12 CPUs, 48 GB. | |
| - **Network, enforced.** Containers sit on `simready-egress`, an internal Docker network. Its only exit is | |
| `simready-egress-proxy` (`runtime/egress_proxy.py`), an HTTPS CONNECT proxy that tunnels only to `api.anthropic.com`, | |
| `platform.claude.com`, `chatgpt.com`, `auth.openai.com`, `opencode.ai`, `mcp.exa.ai` and `search.parallel.ai` (and their | |
| subdomains). Plain HTTP, `pypi.org`, `github.com` and `registry.npmjs.org` are refused (tested in Docker). | |
| - **Cost.** `run.json` `cost`: tokens and USD at list price (Claude's own figure; Codex per request from its session | |
| counts, which survive a budget stop; OpenCode's own figure from its session database, billed as a subscription). | |
| | Image | Dockerfile | Contents | | |
| |---|---|---| | |
| | `simready-generation:latest` | `runtime/Dockerfile` | Python 3.12, MuJoCo 4.0.0, NumPy, SciPy, Pillow, imageio-ffmpeg, ffmpeg, Blender 5.2.3, Codex 0.167.0, OpenCode 1.19.5 + ripgrep 15.1.0, `runtime/requirements-tools.txt` (trimesh, Open3D, OpenCV, scikit-image, PyMeshLab, manifold3d, usd-core, shapely, pandas, matplotlib, scikit-learn, networkx, pygltflib, rtree) | | |
| | `simready-isaac-generation:latest` | `runtime/Dockerfile.isaac` | `nvcr.io/nvidia/isaac-sim:6.2.0` plus the same Blender, Codex and OpenCode; the host ffmpeg is mounted | | |
| ```bash | |
| docker build -t simready-generation:latest -f src/simready/generation/runtime/Dockerfile src/simready/generation/runtime | |
| docker build -t simready-isaac-generation:latest -f src/simready/generation/runtime/Dockerfile.isaac src/simready/generation/runtime | |
| ``` | |
| Both images target Linux AMD64; add `--platform linux/amd64` when building on Apple Silicon. Docker Desktop must | |
| share the repository and run directories. Codex and OpenCode use image binaries; Claude Code still needs a compatible | |
| Linux host executable. Isaac Sim also requires a supported NVIDIA GPU host with NVIDIA Container Toolkit. | |
| An Isaac session needs its CLI's shader-cache volume warmed once (`data/runtime/isaac/smoke_<cli>/smoke.json`): | |
| ```bash | |
| CLI=claude; mkdir -p data/runtime/isaac/smoke_$CLI | |
| docker run --rm --user 0:0 --entrypoint bash --mount type=volume,src=simready-isaac-$CLI-cache,dst=/c simready-isaac-generation:latest -lc "chown 1234:1234 /c" | |
| docker run --rm --gpus device=GPU-... --user 1234:1234 --entrypoint bash -e ACCEPT_EULA=Y -e NVIDIA_DRIVER_CAPABILITIES=all \ | |
| --mount type=volume,src=simready-isaac-$CLI-cache,dst=/isaac-sim/.cache \ | |
| --mount type=bind,src=$PWD/src/simready/generation/runtime/isaac_smoke.py,dst=/work/smoke.py,readonly \ | |
| --mount type=bind,src=$PWD/data/runtime/isaac/smoke_$CLI,dst=/work/output simready-isaac-generation:latest -lc "/isaac-sim/python.sh /work/smoke.py" | |
| ``` | |
| ## Commands | |
| Campaigns can enforce subscription reserves with an optional top-level `quota` object: | |
| ```json | |
| "quota": { | |
| "codex_weekly_remaining_percent": 30, | |
| "poll_seconds": 30, | |
| "opencode_pause_on_limit": true | |
| } | |
| ``` | |
| The host's Codex app-server `account/rateLimits/read` supplies the weekly window (10080 minutes). | |
| At or below the configured reserve, the runner stops dispatching Codex jobs and stops active Codex containers | |
| at their next monitoring check (at most 20 seconds after detection). With a positive reserve, missing or invalid quota data also pause Codex. | |
| Polling and provider reporting delays mean this is not an exact account-wide billing cap; other sessions also use | |
| the account. No reset credits are consumed. Set the reserve to `0` to use the full weekly allowance. Quota policy edits | |
| reload into the existing guard. A reserve-threshold pause otherwise stays paused for this invocation; another CLI | |
| may continue. With a positive reserve, a quota-query failure pauses spending while quota remains unknown. With a | |
| zero reserve, unavailable quota reporting leaves exhaustion enforcement to the provider. Queries retry at the configured | |
| poll interval; a fresh valid reading above the reserve releases only the query-failure pause and its partial job. | |
| OpenCode HTTP 402/429 errors pause its login without retrying the same rejected job. These responses can indicate | |
| either exhausted allowance or a temporary provider rate limit; they do not establish a remaining balance. | |
| Partial quota-stopped runs are retained as `quota_paused`, skipped by evaluation, and never counted as generated. | |
| An explicit restart retries these jobs from the beginning while retaining the partial attempts as provenance. | |
| Completed runs are kept. Existing saved adaptive concurrency cannot exceed the configured `per_cli_max`. | |
| Only one `campaign run` process can hold a campaign's `.run.lock` at once. | |
| For unattended local runs, redirect stdout/stderr to a persistent log and detach stdin; a closed terminal pipe must | |
| not be the process's output destination. Keep Docker, network connectivity and the workstation available. | |
| ```bash | |
| simready generate --track scenes --engine mujoco --id 41159420 --cli codex --model gpt-6.1-sol --budget 900 1800 | |
| simready generate --track objects --engine mujoco --id input_2d_001 --cli claude --claude-config-dir ~/.claude-huan --model claude-opus-5-5 | |
| simready generate --track demos --engine isaac --id ID --cli opencode --model opencode-go/kimi-k3.1-pro --gpu GPU-... | |
| simready generate ... --campaign smoke-test --runs-root data/runtime/smoke # a labelled run outside data/runs | |
| simready campaign run configs/campaigns/example.json --generation-gpus GPU-a --evaluation-gpus GPU-b --render-gpu GPU-b | |
| simready campaign status configs/campaigns/example.json | |
| ``` | |
| A run is `data/runs/<track>/<engine>/<id>/<UTC time>/`: `run.json` (track, engine, item, cli, model, budgets, stage, | |
| `continued_from`, `contract` with name, sha256 and the frozen protocol's sha256, image id, `agent_cli` with version and | |
| login folder, status, timings, `cli_session_id`, throttling, `credential_refresh_persistence`, `cost`), | |
| `submitted_prompt.txt`, `input/`, `tools/`, `output/`, `generation.jsonl` (the CLI's log), `evaluator_protocol.json`, and | |
| `token_usage.json(l)` for Codex and OpenCode. | |
| ## Campaign config | |
| ```json | |
| { | |
| "name": "example", | |
| "budgets": [900, 1800], | |
| "groups": [{"track": "scenes", "engine": "mujoco", "items": ["41159420"]}, | |
| {"track": "objects", "engine": "isaac", "items": ["input_2d_001"], "budgets": [900]}], | |
| "models": [{"cli": "claude", "claude_config_dir": "~/.claude-huan", "model": "claude-opus-5-5", "effort": "medium"}, | |
| {"cli": "codex", "model": "gpt-6.1-sol"}, {"cli": "opencode", "model": "opencode-go/kimi-k3.1-pro"}], | |
| "limits": {"sessions": 24, "per_cli": {"claude:~/.claude-huan": 3, "codex": 4}, "per_cli_max": {"codex": 8}, | |
| "isaac_evaluations": 32, "mujoco_evaluations": 8, "pause_new_jobs_above_load": 170}, | |
| "evaluate": true | |
| } | |
| ``` | |
| Every item of every group runs with every model (`budgets` per group overrides the campaign's). `per_cli` limits the | |
| concurrent sessions of one login, keyed by the login (`claude:<config dir>`) or by the CLI; a login not listed runs one | |
| session at a time. A login whose session fails early or hits a rate limit is held (takes no new sessions); a CLI crash | |
| after 120 s is retried once. State is `data/campaigns/<name>/state.json`; rerunning the command resumes, restarts | |
| interrupted sessions from nothing and retries failures. Each result is evaluated with `simready evaluate` (report in | |
| `<run>/evaluation/`); a campaign refuses to start until every group's protocol is frozen. A campaign stops and removes | |
| only its own leftover containers (label `simready.campaign=<name>`). | |
| A group may list `models` (model names) to run only those. Adding groups or items to a config and rerunning adds | |
| their jobs to the campaign. Scheduling adapts to the host: Isaac sessions and evaluations go to the GPU with the most | |
| free memory, counting jobs started there in the last 3 minutes as `gpu_claim_mib` each (default 16000) and starting a job | |
| only while at least `gpu_keep_free_mib` (default 16000) is left after those claims (other users' work is seen through | |
| nvidia-smi). Both are `limits` keys and apply to sessions and evaluations alike; with the defaults a 32 GB GPU takes one Isaac | |
| job at a time, so lower both on small GPUs (docs/handoff-jiarui.md: 10000 and 10000 for 32 GB RTX 5090s). A login starts at its `per_cli` limit, gains one session after 15 minutes at its limit | |
| with no rate limit, up to `per_cli_max` (default twice the start), and on a rate limit halves its limit, pauses | |
| 10 minutes and requeues a failed session. Edits to the config (groups, models, limits) apply to a running campaign within seconds; a changed | |
| `per_cli` resets that login's limit to the new value. Isaac work is capped by the NVIDIA driver, not GPU memory: about 50 Isaac processes stalled the driver for every | |
| user of the host. `isaac_sessions` and `isaac_evaluations` are starting caps; each grows by one after 5 minutes at the cap | |
| while `nvidia-smi` answers within 3 s, up to `isaac_sessions_max` and `isaac_evaluations_max`, and both drop to 70% (held | |
| for 10 minutes) when it is slower or silent; a changed starting cap applies at once. `isaac_evaluations` and `mujoco_evaluations` are worker counts. GPU containers start at most one per `gpu_start_gap_seconds` (default 15) per pool, and free | |
| memory comes from one `nvidia-smi` reading shared by all schedulers every 15 s: dozens of Isaac containers starting at once | |
| (each runs NVIDIA's container hook) stalled the driver for every user of the host. Evaluations | |
| share GPUs, so real-time factors are not comparable: `run.json` has `evaluation_gpu_shared: true`. | |