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 training.nan_guard is 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)

Resolve the algorithm log root, honoring optional training.log_root overrides.

parse_checkpoint_path(cfg, *, root_dir[, ...])

Resolve a checkpoint path from Hydra config and repository root.

resolve_nan_guard_cfg(training_cfg)

Build the shared NanGuardCfg from training.nan_guard, or None.

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 NanGuardCfg from training.nan_guard, 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 training.nan_guard is enabled.

Parameters:
  • env (Any)

  • training_cfg (Any)

Return type:

None

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.get_log_root(root_dir, cfg)[source]

Resolve the algorithm log root, honoring optional training.log_root overrides.

Parameters:
  • root_dir (str | Path)

  • cfg (DictConfig)

Return type:

Path

unilab.training.run.parse_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]