Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds checkpoint persistence for the AMP replay buffer so training can resume with the same discriminator replay state.
Changes:
- Implement
ReplayBuffer.state_dict()/ReplayBuffer.load_state_dict()to snapshot/restore buffer tensors and counters. - Include the AMP replay buffer snapshot in
AMPOnPolicyRunner.save()checkpoints. - Restore the AMP replay buffer snapshot in
AMPOnPolicyRunner.load()when present.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
amp_rsl_rl/storage/replay_buffer.py |
Adds serialization/deserialization helpers for replay buffer contents. |
amp_rsl_rl/runners/amp_on_policy_runner.py |
Saves/loads replay buffer state as part of training checkpoints. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+134
to
+141
| def state_dict(self) -> dict: | ||
| """Return a serialisable snapshot of the buffer contents.""" | ||
| return { | ||
| "states": self.states[: self.num_samples].clone(), | ||
| "next_states": self.next_states[: self.num_samples].clone(), | ||
| "step": self.step, | ||
| "num_samples": self.num_samples, | ||
| } |
Comment on lines
+144
to
+148
| """Restore the buffer from a snapshot produced by :meth:`state_dict`.""" | ||
| n = state["num_samples"] | ||
| self.states[:n] = state["states"].to(self.device) | ||
| self.next_states[:n] = state["next_states"].to(self.device) | ||
| self.step = state["step"] |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the possibility to save and load the replay buffer state during training.