[Doc] Document checkpointing to resume RL training - #4230
Open
YeonwooSung wants to merge 3 commits into
Open
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4230
Note: Links to docs will display an error until the docs builds have been completed. ❌ 3 New FailuresAs of commit f9a17e7 with merge base 1d3de3d ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Populate the replay buffer from the collector before saving so LazyTensorStorage is initialized and the copy-paste example can run end to end.
Retain and checkpoint SoftUpdate alongside the loss, then demonstrate the optimizer-step and target-step order after restoration so resumed DQN training continues updating its target network.
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.
Description
Adds a Resume training guide to
docs/source/reference/checkpoint.rstso users can save and restore an RL agent with the existing:class:~torchrl.checkpoint.Checkpoint`` API.The new section:
Checkpoint(policy=..., optimizer=..., replay_buffer=..., collector=..., loss_module=..., exploration=..., rng=GlobalRNGState()), thensave/loadwithcomponents={...}andmap_location.TensorDictModule/state_dict(or the buffer'sdump/load), not a pickled mystery container.Includes a compact CartPole DQN snippet a reader can copy.
Motivation and Context
close #3044
The export tutorial is inference-only. Users asked for a copy-paste guide to interrupt training and continue it later.
Checkpointalready exists; this PR documents how to use it rather than inventing a parallel API.Types of changes
Checklist