Add optional capability_manifest passthrough to checkpoints (#352) - #353
Add optional capability_manifest passthrough to checkpoints (#352)#353idoco2003 wants to merge 1 commit into
Conversation
Store an optional top-level `capability_manifest` block from the run params verbatim in the saved checkpoint dict, for both the A2C/PPO and SAC agents, so a declaration of the limits a policy was trained under can travel with the policy. rl_games takes no position on the manifest's schema: the block is stored verbatim and is a no-op when absent. Consumers read `checkpoint['capability_manifest']`. Requested by the maintainer in Denys88#352. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Ido Yahalomi <greenvh@gmail.com>
Denys88
left a comment
There was a problem hiding this comment.
Thanks @idoco2003 — this is clean and well-scoped. Verbatim, schema-agnostic passthrough, fully opt-in, no behavior change when absent, and no new imports (both agents already import torch_ext). self.params is a new attribute on A2CBase/SACAgent with no collision. Tests cover present/absent/None. Approving.
A couple of optional follow-ups (not blocking — happy to merge as-is):
-
Survive resume.
get_full_state_weights()writes the manifest fromself.params, butset_full_state_weights()never reads it back. So resuming from a manifest-carrying checkpoint with a config that omitscapability_manifestwould silently drop it from the next save. Usually fine (the manifest normally lives in the run params across resumes), but if you'd like it to round-trip regardless:if self.params is not None and 'capability_manifest' in weights: self.params.setdefault('capability_manifest', weights['capability_manifest'])
in both
set_full_state_weights()paths — or just a sentence in the PR confirming the resume behavior is intentional. -
Scope note. It's emitted from
get_full_state_weights()(full checkpoint) only, not the weights-onlyget_weights()path — which I think is what you want; just confirming that matches the consumer story in #352.
Naming/placement (top-level params: vs config:) looks fine to me as-is.
What
Adds an optional
capability_manifest:passthrough, as offered in #352.When the training params carry a top-level
capability_manifest:block, rl_games copies it verbatim into the saved checkpoint dict (both the A2C/PPO path and SAC). rl_games takes no position on its schema; the block is stored as-is and is a no-op when absent. Consumers readcheckpoint['capability_manifest'].This lets the limits a policy was trained under travel with the policy, instead of being transcribed by hand downstream and drifting.
Changes
torch_ext.add_capability_manifest(state, params)— small, schema-agnostic helper (verbatim copy, no-op when absent).A2CBaseandSACAgentretainself.paramsand call the helper inget_full_state_weights().tests/test_capability_manifest.py— covers present / absent /None-params.Net diff is +64 lines, no behavior change for existing runs (the block is opt-in).
Context
This comes from URML (an open, Apache-2.0 language for robot intent). The motivating discussion is #352. Prose is AI-assisted and maintainer-reviewed per URML's VIBE.md; happy to adjust naming, placement (top-level params vs
config:), or anything else to fit your preferences.