Repository navigation
[Feature] Add TD-MPC2 planner - #4455
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4455
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
There was a problem hiding this comment.
Let's use test classes whenever we can + short test names
There was a problem hiding this comment.
Done, I refactored the whole chain of PRs to use test classes and short names. These changes are folded into the commits on the PRs that introduced each feature.
There was a problem hiding this comment.
not sure modules/functionals really belong here.
Also another finding from Codex:
Evaluation-time exploration cannot be disabled.
The planner always adds Gaussian noise to the selected action. The reference TD-MPC2 implementation skips this perturbation in evaluation mode. Add an explicit evaluation mode or respect TorchRL’s interaction type, with a regression test.
There was a problem hiding this comment.
I moved the modules and helpers -- does the new layout look better to you?
And nice find from Codex. I missed that because in the official implementation here, the evaluate.py script actually does not set this eval mode. So I thought it was deprecated/unused. Looking closer , it is used in a few other places, so I added that here. Thanks!
124bd3f to
5edbb7e
Compare
c59c96f to
113f5d2
Compare
113f5d2 to
ac4f003
Compare
theap06
left a comment
There was a problem hiding this comment.
Overall LGTM! Just one nitpick
| 1 | ||
| ) | ||
| action = selected[0] | ||
| from ...envs.utils import exploration_type, ExplorationType |
There was a problem hiding this comment.
This import is made at every step. Let's move this to the hot path.
Description
Note
This PR stacks on #4454 . I cannot find a good way to compare the diff against that base, since it is in my own fork.
Once it is merged, I will re-target this one to make the diff easier to read.
This PR introduces the central part of the TD-MPC2 algorithm: the planner module. The planner is responsible for rolling out candidate trajectories at inference time and planning which sequence of actions leads to the best outcome.
Motivation and Context
6th PR in the chain to address #4448 . The planning algorithm is described in depth in the original paper and associated implementation.
Types of changes
What types of changes does your code introduce? Remove all that do not apply:
Checklist
Go over all the following points, and put an
xin all the boxes that apply.If you are unsure about any of these, don't hesitate to ask. We are here to help!