unilab.training.run

Run directory and checkpoint resolution helpers.

Functions

algo_config_dict(cfg)

Resolve the composed cfg.algo subtree into a plain mutable dict.

apply_env_nan_guard(env, training_cfg)

Attach a NanGuard to env when diagnostics are enabled.

build_run_dir_name(timestamp, sim_backend, *)

Return the canonical run directory name shared by all training entries.

format_play_checkpoint_error(cfg, *, ...)

Build the user-facing diagnostic for an unresolvable play checkpoint.

get_log_root(root_dir[, cfg, algo_log_name, ...])

Resolve the algorithm log root.

is_viser_play_render_mode(play_render_mode)

Return whether the configured mode selects the browser-based viser viewer.

nonfatal_play_step(step)

Keep independent post-training play artifacts (ONNX export, video render) from blocking each other: log the failure and continue with the rest.

resolve_configured_checkpoint_path(cfg, *, ...)

Resolve a checkpoint path from Hydra config and repository root.

resolve_nan_guard_cfg(training_cfg)

Build the shared tensor diagnostics config, or None.

resolve_run_log_dir(cfg, *[, world_size, ...])

Resolve one canonical run directory shared by all distributed ranks.

should_run_playback(*, play_only, no_play, ...)

Return whether train/eval should enter playback for the configured mode.

unilab.training.run.build_run_dir_name(timestamp, sim_backend, *, world_size=1)[source]

Return the canonical run directory name shared by all training entries.

Parameters:
  • timestamp (str)

  • sim_backend (str)

  • world_size (int)

Return type:

str

unilab.training.run.algo_config_dict(cfg)[source]

Resolve the composed cfg.algo subtree into a plain mutable dict.

Parameters:

cfg (DictConfig)

Return type:

dict[str, Any]

unilab.training.run.format_play_checkpoint_error(cfg, *, task_log_root, load_path, load_path_dir)[source]

Build the user-facing diagnostic for an unresolvable play checkpoint.

Parameters:
Return type:

str

unilab.training.run.resolve_nan_guard_cfg(training_cfg)[source]

Build the shared tensor diagnostics config, or None.

Parameters:

training_cfg (Any)

Return type:

NanGuardCfg | None

unilab.training.run.apply_env_nan_guard(env, training_cfg)[source]

Attach a NanGuard to env when diagnostics are enabled.

Parameters:
  • env (Any)

  • training_cfg (Any)

Return type:

None

unilab.training.run.is_viser_play_render_mode(play_render_mode)[source]

Return whether the configured mode selects the browser-based viser viewer.

viser is a UniLab-level playback mode layered on top of the unisim PLAY_RENDER_MODES contract; it renders through the shared MuJoCo playback shell instead of a backend-native renderer, so it never reaches SimBackend.resolve_play_render_plan.

Parameters:

play_render_mode (str | None)

Return type:

bool

unilab.training.run.should_run_playback(*, play_only, no_play, play_render_mode)[source]

Return whether train/eval should enter playback for the configured mode.

Parameters:
Return type:

bool

unilab.training.run.nonfatal_play_step(step)[source]

Keep independent post-training play artifacts (ONNX export, video render) from blocking each other: log the failure and continue with the rest.

Parameters:

step (str)

Return type:

Iterator[None]

unilab.training.run.get_log_root(root_dir, cfg=None, *, algo_log_name=None, log_root=None)[source]

Resolve the algorithm log root.

The configured training.log_root (or the explicit log_root argument) wins; otherwise the UNILAB_TEST_LOG_ROOT override applies; otherwise the default is <root_dir>/logs/<algo_log_name>. Pass either a composed Hydra cfg or an explicit algo_log_name.

Parameters:
Return type:

Path

unilab.training.run.resolve_run_log_dir(cfg, *, world_size=1, timestamp=None, root_dir=None)[source]

Resolve one canonical run directory shared by all distributed ranks.

Parameters:
Return type:

str

unilab.training.run.resolve_configured_checkpoint_path(cfg, *, root_dir, load_run=None, task_name=None, checkpoint=None, suffix='.pt')[source]

Resolve a checkpoint path from Hydra config and repository root.

Parameters:
Return type:

tuple[Path | None, Path | None]