-
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] - Enable multi-learner setup for hybrid stack BC #46436
[RLlib] - Enable multi-learner setup for hybrid stack BC #46436
Conversation
…i-learner setups in BC impossible on the hybrid stack. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
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.
LGTM! Thanks for this fix @simonsays1980 .
… and added logic in BC to add the used module ID if existent. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
rllib/algorithms/bc/bc.py
Outdated
train_results = self.learner_group.update_from_batch( | ||
batch=train_batch.as_multi_agent( | ||
module_id=list(self.config.policies)[0] | ||
if self.config.policies |
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.
self.config.policies
should always be available and you should always be able to iterate through it. So I don't think, we need this if-check here.
@@ -147,6 +147,7 @@ | |||
TRAINING_ITERATION: args.stop_iters, | |||
} | |||
|
|||
args.local_mode = 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.
remove?
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.
Good catch!
@@ -907,14 +908,20 @@ def get(self, key, default=None): | |||
return default | |||
|
|||
@PublicAPI | |||
def as_multi_agent(self) -> "MultiAgentBatch": | |||
"""Returns the respective MultiAgentBatch using DEFAULT_POLICY_ID. | |||
def as_multi_agent(self, module_id: Optional[ModuleID] = None) -> "MultiAgentBatch": |
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.
perfect!
…able and removed local mode from example which is a relict from debugging. Signed-off-by: simonsays1980 <simon.zehnder@gmail.com>
Why are these changes needed?
This PR does fix a bug in hybrid stack BC which was hindering multi-learner setups for offline RL.
Related issue number
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.