Skip to content

Commands

The training and evaluation commands: ndm-train and ndm-eval (console entry points), and python -m for the other tasks. Their arguments are built by these functions, so that other tools take them too (ndm_gym.wmbench.fit takes ndm_gym.train's). The commands that run the simulator need it (Installation); their argument definitions import without it.

ndm_gym.train

Training loop (SuperMimic Algorithm A.1): collect -> fit world model -> BPTT policy update.

--algo selects the algorithm (:mod:ndm_gym.algos); the simulator, observations, networks, replay buffer and schedule are shared. Run: python -m ndm_gym.train --algo supertrack|supermimic --log_dir logs/<run>. --resume continues from a run's last.pt (the networks with their normalizers, the optimizers' states, the algorithm's own state); the replay buffer is not saved, so a resumed run refills it with --warmup_steps of collection.

main

main()

parse_args

parse_args()

add_train_args

add_train_args(parser: ArgumentParser)

Training arguments (also used by the offline world-model benchmark, ndm_gym.wmbench.fit).

add_speed_args

add_speed_args(
    parser: ArgumentParser, rigidformer: bool = True
)

Speed options of the training run (off by default). The tools that rebuild a run's arguments (tools/grad_stats.py) add them after add_train_args, as parse_args does. rigidformer: also the G1 RigidFormer's kernel options (a trainer with a RigidFormer of its own leaves them out: train_muscles).

ndm_gym.evaluate

Checkpoint evaluation (paper Appendix F.1) on all motions of the library.

Each motion plays once from its first frame with friction 1.0, no domain randomization, no observation or action noise. A motion fails if the rollout triggers the training termination. Normalized return is the undiscounted reward sum divided by its maximum attainable value. Tracking errors (tracked bodies) are averaged over each clip's steps until it ends or fails, then over clips. Optional robustness test: horizontal root-velocity pushes at a fixed period, identical for every policy.

Run as a watcher: python -m ndm_gym.evaluate --run_dir logs/<run> --watch.

main

main()

parse_args

parse_args()

evaluate

evaluate(
    env,
    kin,
    motion,
    mdp,
    ck: dict,
    record: str | None = None,
    push: PushCfg | None = None,
    graph: bool = False,
) -> dict

graph: each step as one CUDA graph (_loop_graph; the same values; no record). In the two-robot scene (PairedTrackingSim) each instance plays its own side of its env's two-person clip (env.instance_clip), the results are per instance (named by their clips), and pairs gives each two-person clip's outcome.

evaluate_group

evaluate_group(
    env,
    kin,
    motion,
    mdp,
    cks: list[dict],
    repeats: int,
    graph: bool = False,
) -> list[list[dict]]

evaluate of the checkpoints cks, each repeats times, at once (--group): the simulator holds C * len(cks) * repeats worlds, world (m * repeats + r) * C + c playing clip c under checkpoint m. The evaluation is latency-bound at C worlds, so a group costs about one evaluation's wall-clock. The checkpoints share their policies' layout and inputs. Returns each checkpoint's repeats results, as evaluate's (one-robot scene, no pushes).

ndm_gym.configs

Named run configurations: each task's best settings for SuperTrack and SuperMimic as this repository measured them (the README's tables), so that ndm-train --config lafan1-supertrack-fast stands for the option list. A configuration expands into its options before the command line's own, which take precedence where an option takes a value (a switch it sets cannot be turned off). Each trainer reads only its own configurations; an unknown name is an error, and --config list prints a trainer's names with what each measured.

expand

expand(argv: list[str], trainer: str) -> list[str]

argv with --config NAME (or --config=NAME) followed by NAME's options, the rest after them; --config list prints the trainer's configurations and exits. The --config option stays in argv, so that the trainer records it.

add_config_arg

add_config_arg(parser)

The --config option itself (expanded before parsing by expand), so that --help lists it and the run records it.

ndm_gym.train_hoi

Training loop for HDMI's human-object interaction tasks (docs/hoi_design.md): collect in HDMISim under HDMI's training conditions -> fit the scene's neural dynamics model on replay windows -> policy update through imagined rollouts (ndm_gym.algos.hoi_algos). The schedule and the algorithms' settings are LAFAN1's (ndm_gym.train's arguments); those that only LAFAN1 training implements are refused unless left at their defaults (UNSUPPORTED).

Every collection step is guarded against non-finite or diverged simulator states (ndm_gym.algos.hoi_guard): a flagged env is terminated and reset, its transition enters the replay sanitized and stays out of the model's windows and the normalizers. Each log row counts the flagged envs and the skipped updates; a run stops at a log row, before writing a checkpoint, when they or the parameters are out of bounds (hoi_guard.check). last.pt holds what --resume continues from: the networks with their normalizers, the optimizers' states and SuperTrack's loss weights. The replay is not saved; a resumed run refills it with --warmup_steps of collection, as a new run starts, and continues its log.

Run: python -m ndm_gym.train_hoi --task move_suitcase --algo supermimic --log_dir logs/<run>

main

main()

parse_args

parse_args(argv: list[str] | None = None)

ndm_gym.evaluate_hoi

Checkpoint evaluation on HDMI's human-object interaction tasks, the way HDMI evaluates a policy (LeCAR-Lab/HDMI @ 32282f6: scripts/eval.py with cfg/eval.yaml, which runs scripts/helpers.py:evaluate). One protocol scores the SuperTrack and SuperMimic checkpoints of ndm_gym.train_hoi and the PPO-ROA checkpoints of ndm_gym.train_ppo_hoi. References are ALIAS:line as in docs/hdmi_task_spec.md, plus EVY = cfg/eval.yaml and DIST = active_adaptation/learning/modules/distributions.py.

HDMI's evaluation, from its code: * 2048 envs (EVY:41-42, which overrides Y:13 because EVY's own entries come last in its defaults, EVY:36-39). The paper's statistics are over 4096 environments (arXiv 2509.16757, §V), the count of the evaluation that scripts/train.py runs on its training env after training (TRN:194-196); --num_envs 4096 gives that count. * env.eval() (HLP:215-216) sets training = False (torchrl's EnvBase is an nn.Module). Then every episode starts at frame 0 (CMD:144-145) without noise on the robot's root pose and velocity (CMD:169-170, 177-178). Nothing else reads the flag: the robot's joint noise (CMD:187-191), the object's pose noise and a hinge's angle and rate noise (CMD:463-467, 503-507), the reset draws of the joint offsets, the action delay and filter and the hinge's friction (RND:742-744, ACT:86-95, HRN:107-112), the startup randomization (§7) and the observation noise (OC:27-34, 54-62, 113-114; OBS:282-300, 338-349, 368-380) stay on. The observation normalizer is frozen (EVY:20, HLP:155-157). * Actions are the policy distribution's mode (HLP:198, 226), the Gaussian's mean (DIST:139-158): a teacher's actor on its privileged encoder, a student's on the adaptation EMA's features (PPO:406-439). * The seed is set (HLP:217, ENV:550-553; seed 0, EVY:18) and all envs are reset; then max_episode_length control steps (HLP:227), each env reset as soon as its episode is done (HLP:234). Only every env's first episode is scored (HLP:246-250); episode_cnt counts all episode ends in the window (HLP:245). * Terminations as in training (§6); truncation at the clip's end (t >= L) or at max_episode_length (ENV:503-505, CMD:229-233). traverse_door's clip (1463 frames) outlasts its 1000-step episodes, so it cannot succeed. * Statistics (HLP:252-282): for every stats key (ENV:161-169, 276, 287, 315), the mean and std over envs of its value at the first episode's last step: the episode length; the success flag; and, divided by the episode length, every reward term's sum of weight x value (disabled terms too, ENV:620-647, so also the debug group's tracking errors, Y:232-241), every group's return (its reward times dt) and the termination flags of that step. Success is HDMI's frame counter at L - 1 when that step's rewards are computed (CMD:225-227, ENV:421-424): the episode reached the clip's end, also if a termination fires at that same step.

HDMI's paper reports the success rate ("finishes the task without triggering any termination") and "joint and body tracking errors" without definitions; the code computes errors only as the debug group's terms, all reported here.

Here: HDMISim in eval_mode (frame 0, no root pose or velocity noise) with one spare env whose index pads the done envs' indices to a fixed count (as ndm_gym.train_ppo_hoi), HDMITask with its observation noise, the run's policy acting deterministically, HDMI's loop and statistics (hdmi in the result, under HDMI's keys), and per checkpoint: success rate and count, mean episode length and fraction of the clip reached, the termination breakdown (the fraction of first episodes that ended with each term's flag on), each reward group's mean per step, HDMI's tracking errors, the keypoint position error (the mean over the 16 keypoints of the world-frame error against the frame HDMI compares with, averaged over the episode; its mean and 90th percentile over envs), the object's position and orientation error or the hinge angle error (the state after the step against that frame, as the terminations compare), and the evaluation's time. Errors in m and rad; group rewards per step include HDMI's factor dt.

Not reproduced: the physics engine (MuJoCo-Warp instead of PhysX) and the per-env object scale (scale 1, as in training; see ndm_gym.sim.rigid.hdmi_sim). HDMI's second observation of an episode reads its previous episode's command buffers (§0); here the reset state, as in training. The first observation is HDMI's all-zero one for the PPO checkpoints (ENV:385-386) and the reset state's for SuperTrack and SuperMimic, each as it was trained (train_ppo_hoi, train_hoi). HDMI draws its startup randomization before it sets the seed (HLP:130-162); here the seed also fixes it.

Reproducibility: the startup randomization, the resets' draws and the observation noise come from --seed, drawn in a fixed order and amount whatever the policy does, so that every checkpoint and algorithm starts each env's first episode from the same reset and sees the same observation noise at each step. MuJoCo-Warp accumulates contact and constraint forces with atomics, so two evaluations of one checkpoint agree only up to the GPU's summation order, which can grow along an episode.

Run: python -m ndm_gym.evaluate_hoi --run_dir logs/<run> --watch (appends to /eval_hoi.csv), or one checkpoint: python -m ndm_gym.evaluate_hoi --run_dir logs/<run> --ckpt logs/<run>/ckpt_<it>.pt --out_json <file>.

main

main()

parse_args

parse_args()

ndm_gym.train_ppo_hoi

Model-free baseline for HDMI's human-object interaction tasks: HDMI's PPO-ROA (ndm_gym.algos.ppo_hoi) in HDMISim with HDMITask under HDMI's training conditions, with HDMI's env count, rollout length and update schedule (TRN:116-188), and the quantities train_hoi logs where they apply, for the wall-clock comparison with the model-based runs.

A step: the policy acts on the normalized observation, the simulator steps, HDMITask gives the observation groups, rewards and terminations, the normalizer adds the observation; envs that are done (terminated, or truncated at the clip's end or the episode length) are reset at once, their next observation HDMI's all-zero reset observation and their residual base zero (ENV:371-389). After train_every steps the learner updates (PPOROA.update).

Deviations from HDMI's trainer, none of which reaches a loss: * HDMI's second observation of an episode (step_count 1) is built from command buffers that Isaac Lab still holds from the previous episode, as no command update runs at a reset (§0); here from the reset state, as HDMISim and HDMITask produce it. Both losses drop these transitions (step_count > 1), so the episode's second action and the normalizer's statistics see the difference. The first observation is HDMI's, all zeros. * HDMI's trainer takes one environment step before training to size its buffers and drops its result (TRN:120-123); omitted. * HDMI's teacher rollout also runs the adaptation module and drops its output (PPO:409-412); omitted.

An engine deviation (docs/hoi_design.md §1): every step is guarded against non-finite or diverged simulator states (ndm_gym.algos.hoi_guard), inside the compiled task step. A flagged env is terminated (no bootstrap) and reset; its rewards and observation groups are zeroed before the normalizer adds them. The log counts the flagged envs per row, and a run stops at a log row, before writing a checkpoint, when they or the parameters are out of bounds (hoi_guard.check).

Efficiency: no host synchronization or host copy in the rollout and the update. The rollout storage is preallocated on the device; the policy, the normalizer and the episode statistics of a step are compiled, as are HDMITask's step and the learner's losses; HDMISim runs each control step as one CUDA graph (--eager_sim: without), and the learner each minibatch step (--no_graphs: without). HDMISim.reset takes env indices, whose number would need a synchronization to read: the simulator runs one spare env beyond the N of the learner, reset at every step, whose index pads the done envs' indices to a fixed count. --profile k counts kernels, launches and synchronizations of iteration k.

Run: python -m ndm_gym.train_ppo_hoi --task move_suitcase --log_dir logs/<run> (the teacher), then the student: python -m ndm_gym.train_ppo_hoi --task move_suitcase --phase finetune --teacher logs/<run>/ckpt_<it>.pt --log_dir logs/<run2>

main

main()

parse_args

parse_args()

ndm_gym.train_muscles

Training loop for MuscleVAE's muscle-actuated character (docs/musclevae_design.md §4): collect in MuscleSim with MuscleVAE's environment (its resets, reference switches and termination; ball joints as Euler hinges and ODE's damped step by default, the simulator their released policy tracks in) -> fit the world model on replay windows -> policy update through imagined rollouts (ndm_gym.algos.muscle_algos). The schedule and the algorithms' settings are LAFAN1's (ndm_gym.train's arguments): those in action units mapped by tasks.muscle_tracking.ACTION_UNIT, those only LAFAN1 training implements refused unless left at their defaults (UNSUPPORTED).

Collection: the simulator's control step is a CUDA graph; the policy, the transition's writes into the replay, the normalizers' updates, the statistics and the masked reset run on the device without a host synchronization per step. Every step is guarded (algos.muscle_guard): an env whose state after the step is non-finite or beyond the bounds is terminated and reset, and its transition enters the replay with its next state replaced by its state (bad), kept out of the world model's windows, the imagination's starts and the normalizers. Each log row counts the flagged envs and the skipped updates; a run stops at a log row, before writing a checkpoint, when they or the parameters are out of bounds (muscle_guard.check). last.pt holds what --resume continues from: the networks with their normalizers, the optimizers' states and SuperTrack's loss weights. The replay is not saved; a resumed run refills it with --warmup_steps of collection, as a new run starts, and continues its log. MUSCLE_PROFILE=1 times the phases.

Of ndm_gym.train's speed options and BlinkMimic's, off by default, muscle training implements --fused_adam, --elementwise_3x3, --combo_kernels, --pi_ema, --pi_opt/--wm_opt muon (--wm_opt also with the RigidFormer, Muon on its blocks' weight matrices as in LAFAN1 training), --pi_lr_mult ramped at --lr_decay_by, --no_sync, --update_graphs, --graph_early, --ckpt_light (with --last_every_min, the full last.pt too, every that many minutes of training), and --collect_graph with --reset_masked: a collection step with its masked resets as one CUDA graph (MuscleSim.capture: the policy, the control step's body, the replay write, the normalizers, the statistics, the reset's body); the others are refused (SPEED_UNSUPPORTED).

Run: python -m ndm_gym.train_muscles --algo supertrack --st_fail_w 5 --st_balance_w 4 --log_dir logs/<run>

main

main()

parse_args

parse_args(argv: list[str] | None = None)

ndm_gym.train_hand

Training loop for hand-object tracking on one SPIDER clip (docs/tasks/hand.md): collect in HandSim -> fit the world model on replay windows -> policy update through imagined rollouts (ndm_gym.algos.hand_algos). The schedule and the algorithm's settings are LAFAN1's (ndm_gym.train's arguments) with the defaults of HAND_DEFAULTS; those that hand training does not implement are refused unless left at their defaults (UNSUPPORTED).

An iteration is one control step of every world, --wm_batches world-model steps and, after --wm_only_iters, one policy and critic update. Writes train_log.csv, args.json and last.pt to --log_dir, with --phase_times also phase_times.csv: the time of each of an iteration's phases, the device synchronized at every boundary, a row per log row and a summary at the end (hand_fast.PhaseTimes; a slower run, the same results). last.pt holds what --resume continues from: the networks with their normalizers and the optimizers' states. The replay is not saved; a resumed run refills it with --warmup_steps of collection, as a new run starts, and continues its log.

Systems options (ndm_gym.algos.hand_fast, off by default): --fused_adam, --reset_masked, --no_sync (an iteration without host-device synchronization), --collect_graph and --update_graphs (the collection step and the updates as CUDA graphs), --compile_eager (the collection's forward kinematics compiled), --pi_opt muon, --wm_opt muon, --pi_ema and --pi_lr_mult; engineering options (--compile_updates, --compile_collect, --compile_rollout, --mix_order_reductions, --autotune_gemm and others: hand_fast's docstring). HAND_PROFILE=1 prints each part's time with every log row. --layout AL | AWL (ndm_gym.algos.hand_layout, off by default): the iteration's steps on two or three GPUs at once, each on the others' results of the previous iteration.

Run: python -m ndm_gym.train_hand --clip data/spider/processed/<dataset>/xhand/right/<task>/0 --log_dir logs/<run>

main

main() -> None

parse_args

parse_args(
    argv: list[str] | None = None,
) -> argparse.Namespace

ndm_gym.evaluate_hand

Evaluate a hand-object tracking policy (train_hand's last.pt) on its clip, in the simulator.

python -m ndm_gym.evaluate_hand --ckpt logs/<name>/last.pt --out logs/<name>/evaluation

One rollout from the unperturbed first frame to the last, without resets, is saved as rollout.npz (the scene's qpos at every control step, for tools/render_hand.py) with its errors in metrics.json, beside the same rollout with the reference pose as the position targets in the policy's place (reference_targets_qpos); with --save_targets also both rollouts' position targets and the policy's actions (for tools/hand_motion_check.py). --num_envs rollouts from perturbed starts (training's reset noise) give the success rate and the errors, and as many with the reference pose as the targets those to compare with. A rollout succeeds if it never terminates (the object and the palm stay within the task's distances of the reference) and the object ends within --success_pos of its last reference position.

main

main() -> None

rollout

rollout(
    sim,
    algo,
    task,
    policy: bool = True,
    record: dict | None = None,
)

Every world from its current start to the reference's last frame, under the policy or, without it, under the reference pose as the position targets. Returns the states (T, N, state_dim), the scene's qpos (T, N, nq) and whether each world terminated. record (a dict): its lists actions and targets get each step's action and position targets (N, num_joints); the rollout is the same with it or without it.

ndm_gym.train_quadrotor

Training loop for quadrotor trajectory tracking on flights of Race Against the Machine (docs/tasks/quadrotor.md): collect in QuadSim -> fit the world model on replay windows -> policy update through imagined rollouts (ndm_gym.algos.quadrotor_algos). The loop, the schedule and the systems options are hand-object tracking's (ndm_gym.train_hand, ndm_gym.algos.hand_fast) with the defaults of QUAD_DEFAULTS; ndm_gym.train's arguments that this training does not implement are refused unless left at their defaults (UNSUPPORTED).

An iteration is one control step of every world, --wm_batches world-model steps and, after --wm_only_iters, one policy (and critic) update. Writes train_log.csv, args.json and last.pt to --log_dir (--ckpt_keep: also ckpt_<iteration>.pt at every --ckpt_every). --resume continues from a run's last.pt; the replay is not saved. QUAD_PROFILE=1 prints each part's time with every log row.

Run: python -m ndm_gym.train_quadrotor --flight flight-01a-ellipse --log_dir logs/<run>

main

main()

parse_args

parse_args(argv: list[str] | None = None)

build

build(
    flights: list[str],
    data_dir: str,
    device: str,
    reward_std_scale: float = 1.0,
    goal_stride: int = 5,
    model_spec=None,
)

The drone's model and specification and the task of the flights. model_spec: the specification of the simulated model where it is not the task's (evaluate_quadrotor's scaled inertia, drag and mass).

ndm_gym.evaluate_quadrotor

Evaluate a quadrotor tracking policy (train_quadrotor's last.pt or a kept checkpoint) on its flights, in the simulator.

python -m ndm_gym.evaluate_quadrotor --ckpt logs/<name>/last.pt --out logs/<name>/evaluation

Per flight: --num_envs rollouts of the whole flight from perturbed starts (training's reset noise at the flight's first frame), without exploration noise and without resets, and as many with the reference's feedforward command alone in the policy's place (zero actions: the thrust and the body rates of the reference, open loop). A rollout succeeds if it never terminates (the position stays within the task's distance of the reference). The errors are means over the frames of the rollouts that succeed, pos_max_mm the largest position error of those rollouts after the flight's first second (the perturbed start); flown_s is the mean time in the air before a termination (the flight's length for a success). One rollout from the unperturbed first frame is saved as rollout_<flight>.npz (the state at every control step, beside the same start flown under the reference's command and the flight's gates, for tools/render_quadrotor.py). --flight: other flights than the checkpoint's (held-out ones). --inertia_scale, --drag_scale, --mass_scale: the simulated drone's inertia, drag and mass times these, the policy and the reference's feedforward command as trained.

main

main()

rollout

rollout(sim, algo, task, start: int, policy: bool = True)

Every world from the frame start (perturbed as the simulator's noise says) to its flight's last frame, under the policy or, without it, under the reference's feedforward command. Returns the states (T, N, STATE_DIM), whether each world terminated and the step of its termination (T - 1 without one).

ndm_gym.train_quadruped

Training loop for quadruped motion tracking: the Go2 follows retargeted dog motion capture (motion.sources.lifelike), one clip or many with one policy: collect in QuadrupedSim -> fit the world model on replay windows -> policy update through imagined rollouts (ndm_gym.algos.quadruped_algos). The schedule and the algorithm's settings are LAFAN1's (ndm_gym.train's arguments) with the defaults of QUADRUPED_DEFAULTS; those that quadruped training does not implement are refused unless left at their defaults (UNSUPPORTED).

An iteration is one control step of every world, --wm_batches world-model steps and, after --wm_only_iters, one policy (and critic) update. Writes train_log.csv, args.json and last.pt to --log_dir. last.pt holds what --resume continues from: the networks with their normalizers and the optimizers' states. The replay is not saved; a resumed run refills it with --warmup_steps of collection, as a new run starts, and continues its log. --keep_ckpts also keeps the policy of every --ckpt_every iterations (ckpt_<iteration>.pt, with the run's wall time), which evaluate_quadruped --ckpts evaluates for the training time to a given success.

Systems options (the hand-object task's, ndm_gym.algos.hand_fast, off by default): --fused_adam, --reset_masked, --no_sync (an iteration without host-device synchronization), --collect_graph and --update_graphs (the collection step and the updates as CUDA graphs), --compile_eager (the collection's forward kinematics compiled), --pi_opt muon, --wm_opt muon, --pi_ema and --pi_lr_mult. QUADRUPED_PROFILE=1 prints each part's time with every log row.

Run: python -m ndm_gym.train_quadruped --clips dog_quad_walk_002_1 --log_dir logs/<run> (--clips: clip names or globs in data/lifelike_go2, comma-separated, or a directory; default every clip)

main

main()

parse_args

parse_args(argv: list[str] | None = None)

build

build(
    clips: str | list[str] | None,
    device: str,
    reward_std_scale: float = 1.0,
    kp: float | None = None,
    kd: float | None = None,
    joint_damping: float | None = None,
)

The scene, kinematics, task and clip names of the clips (motion.sources.lifelike.clip_paths).

ndm_gym.evaluate_quadruped

Evaluate a quadruped tracking policy (train_quadruped's last.pt), or the reference pose alone as the position targets, on every clip in the simulator.

python -m ndm_gym.evaluate_quadruped --ckpt logs/<name>/last.pt --out logs/<name>/evaluation
python -m ndm_gym.evaluate_quadruped --open_loop --clips dog_quad_walk_002_1 --out logs/open_loop
python -m ndm_gym.evaluate_quadruped --ckpts logs/<name> --out logs/<name>/evaluation

Each clip is rolled out --num_envs times (256; with many clips at most --max_worlds worlds in all, shared evenly), each in a world of its own, from its first frame with the training's perturbation of the start (the joints and the velocities; evaluation seed --seed), without exploration noise, to its last frame. The clips are rolled out in groups of similar length where that is cheaper (length_buckets), a simulator per group, so that the short clips' worlds do not run on to the longest clip's end; the policies evaluated together (the checkpoints of --ckpts, the policy, the reference targets and the pushes of --ckpt) share each group's simulator, up to --batch_worlds worlds in it (rollout_sums): a control step costs about as much for few worlds as for many. A rollout succeeds if it never terminates (tasks.quadruped_tracking's termination); a clip's success is that of all its rollouts, success_rate their share, and the summary's success_rate the mean of the clips'. The errors are means over the rollouts and the frames before a rollout's termination, if any: the trunk's position (mm) and rotation (rad), the feet in the world and about the trunk in its heading frame (mm), the joints (rad and degrees, RMS).

The return and the failed clips are ndm_gym.evaluate's (the G1's tracking), over several rollouts of a clip in place of one: norm_return is a rollout's undiscounted reward sum, the steps after a termination counting nothing, over the most the clip's steps can give (the reward's positive weights), its mean over a clip's rollouts and then over the clips (norm_return_framew: over all steps alike); failed_clips is the mean number of clips failed by a pass of one rollout per clip (the sum of the clips' failed shares), failed the clips with a success rate below --clip_success (1: any rollout failed) and n_failed their number. --push <m/s> [<m/s> ...]: the policy's rollouts again with a horizontal velocity of that size added to the trunk, in a random direction, every --push_every seconds (2; seed --push_seed, the same pushes for every policy), as ndm_gym.evaluate's root pushes; push/<m/s> in metrics.json.

The same rollouts with the reference pose as the targets in the policy's place (reference_targets, the open-loop baseline) are evaluated beside them. Writes metrics.json (per clip and over all, frames weighted alike) and with --save_rollout rollout.npz, of one more rollout per clip from the unperturbed start (per clip the scene's qpos at every control step, the reference's, and the frame of the termination or -1: <clip>/qpos, <clip>/reference_qpos, <clip>/reference_targets_qpos, <clip>/terminated_at).

--ckpts <run directory>: the same evaluation (the policy only) of every ckpt_<iteration>.pt that train_quadruped --keep_ckpts kept, from the same perturbed starts, with at most --ckpt_worlds worlds in all (2048: a clip's 256 rollouts with up to 8 clips, 31 each with 65); writes checkpoints.json: per checkpoint its iteration, the run's wall time there (minutes) and the summary, and minutes_to_success: the wall time of the first checkpoint from which every later one has a success rate of --success or more and, with --success_trunk_mm, the trunk within that distance on average (null: none).

main

main()

rollout_sums

rollout_sums(
    sim,
    task,
    pis: list,
    goal_frames: int,
    noise: bool = False,
    push: tuple | None = None,
    clips=None,
)

rollout of several policies at once, reduced per world as summarize_sums reads it. The worlds are len(pis) blocks of sim.N / len(pis), block k under pis[k] (a policy network, None: the reference pose as the targets), each laid out as rollout's (clips) and started from the same perturbed starts, those of rollout with one block. push: rollout's, its size per block (a list), the same directions in every block. A step's physics costs about the same for few worlds as for many, so the blocks share it. Returns per world the sums of step_metrics and of the reward over the steps before a termination (that step included), and the step of the termination (-1: never).

summarize_sums

summarize_sums(
    task,
    sums: dict,
    term_at,
    clip_names: list[str],
    ret=None,
    clip_success: float = 1.0,
) -> dict

summarize from per-world sums over the steps before a termination (that step included): of step_metrics (sums) and of the reward (ret).

minutes_to_success

minutes_to_success(
    rows: list[dict],
    success: float,
    trunk_mm: float | None = None,
) -> float | None

The wall time (minutes) of the first checkpoint of rows (in training order) from which every later one has a success rate of success or more (and, with trunk_mm, a mean trunk error of at most that); None if the last one has not.