-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RLlib] Add example: Pre-train an RLModule
single-agent, then bring checkpoint into multi-agent setup and continue training.
#44674
[RLlib] Add example: Pre-train an RLModule
single-agent, then bring checkpoint into multi-agent setup and continue training.
#44674
Conversation
…define the model config for 'RLmodule' in a unified way without interfering with the old stack. Reconfigured DQN Rainbow with it. Signed-off-by: Simon Zehnder <[email protected]>
…d examples accordingly. Signed-off-by: Simon Zehnder <[email protected]>
…ordingly. In addition, fixed some typos. Signed-off-by: Simon Zehnder <[email protected]>
…g_dict' in 'AlgorithmConfig.rl_module' as they were failing. Something is still wrong with the VisionNet in 'connector_v2_frame_stacking' example. Signed-off-by: Simon Zehnder <[email protected]>
…emains b/c low priority. Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
…rl_module_api' needed a 'False' for error - so only wanring. Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
…nstead of model_config. Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
…odule()'. Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
…ot using the corresponding default model configuration of the training algorithm. Also added a pre-training example for MARL. Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
…in single module and load its checkpoint into a MARL setting for one policy. Signed-off-by: Simon Zehnder <[email protected]>
RLModule
pre-training example for multi-agent setupRLModule
pre-training example for multi-agent setup.
… external module did not use the default model config of the algorithm. Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
…l-config-for-new-api-stack
Signed-off-by: sven1977 <[email protected]>
config = ( | ||
PPOConfig() | ||
# Enable the new API stack (RLModule and Learner APIs). | ||
.experimental(_enable_new_api_stack=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is done automatically by the run_rllib_example_script_experiment
util.
marl_module_spec = MultiAgentRLModuleSpec(module_specs=module_specs) | ||
|
||
# Register our environment with tune if we use multiple agents. | ||
if args.num_agents > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this if-block needed? We assert that this command line arg is >0 above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I guess we can remove this here. Good catch @sven1977 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! I removed this in the follow-up commit.
Signed-off-by: Sven Mika <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nice example and PR! Thanks @simonsays1980 !
Just a few nits and waiting for:
- We must add this great example to the BUILD!
- Can we rename the script into a more descriptive name? Like
pretraining_single_agent_training_multi_agent
<- something like this that more describes the exact sequence of things we do here.
…agents. Signed-off-by: Simon Zehnder <[email protected]>
Ok, cool! Can we also add this example script to BUILD? |
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
Signed-off-by: Simon Zehnder <[email protected]>
@@ -2873,7 +2873,14 @@ py_test( | |||
size = "small", | |||
srcs = ["examples/rl_modules/classes/mobilenet_rlm.py"], | |||
) | |||
|
|||
py_test( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Signed-off-by: Sven Mika <[email protected]>
Why are these changes needed?
So far, we have no example that shows users how to pre-train certain policies and load the checkpoints.
This PR shows users how to pre-train a module in single-agent mode and load its checkpoint in another training run into a MARL setup.
Related issue number
Related to #44263
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.