unilab.training.experiment.patch_rsl_rl_resume_state¶
- unilab.training.experiment.patch_rsl_rl_resume_state()[source]¶
Persist and restore UniLab progress through rsl-rl checkpoints.
Without this patch, rsl-rl’s
Logger.__init__writestot_time = 0andtot_timesteps = 0andOnPolicyRunner.loadnever refreshes them, so theTrain/mean_reward/timeandTrain/mean_episode_length/timeTensorBoard scalars (which useint(self.tot_time)as their step) restart from 0 on every resumed run and visually overlap the original segment. See issue #441.The patch wraps
OnPolicyRunner.save/OnPolicyRunner.loadto round-trip plain progress in the saved dict: :rtype:Noneunilab_logger_state:Logger.tot_time/tot_timesteps(required);unilab_env_training_state: the wrapped TorchEnv’s versioned training state, written only when the environment publishes one.
Loading fails closed (issue #2416). A checkpoint must carry a valid
unilab_logger_state; pre-patch rsl-rl checkpoints without it are rejected with a message describing the minimum supported format instead of silently restarting progress from 0. When the active environment publishes training state, the checkpoint must also carry its versionedunilab_env_training_state; environments without exportable state neither write nor require the key, and no placeholder value is fabricated.Checkpoints are immutable load inputs. The loader never repairs, rewrites, upgrades, or migrates a checkpoint file. Environment state is plain versioned JSON data; no Torch tensor, backend, environment, or manager object is serialized through this path.