Fix bug in ModelCatalog when using custom action distribution#12846
Fix bug in ModelCatalog when using custom action distribution#12846sven1977 merged 4 commits intoray-project:masterfrom
Conversation
|
@sven1977 (I can't assign you as reviewer) |
|
Thanks @janblumenkamp for this PR. |
…custom action dict
…_action_distribution
d5224a0 to
67bd26e
Compare
|
Hey @janblumenkamp , thanks for doing this PR! Could you fix the test_catalog test case? It's just a simple key error caused by an empty config inside the test case I think. |
|
I think this fixed the issue, but I am not sure if the current fails are caused by me or by master? |
| dist_cls = ModelCatalog._get_multi_action_distribution( | ||
| dist_cls, action_space, {}, framework) | ||
| return ModelCatalog._get_multi_action_distribution( | ||
| dist_cls, action_space, config, framework) |
There was a problem hiding this comment.
Passing the original config here seems to lead to recursion, as _get_multi_action_distribution also calls get_action_dist and config still contains the custom_action_dist key.
Perhaps:
if config.get("custom_action_dist"):
custom_action_config = config.copy()
action_dist_name = custom_action_config.pop("custom_action_dist")
logger.debug(
"Using custom action distribution {}".format(action_dist_name))
dist_cls = _global_registry.get(RLLIB_ACTION_DIST,
action_dist_name)
return ModelCatalog._get_multi_action_distribution(
dist_cls, action_space, custom_action_config, framework)|
All good now! Thanks everyone. |
sven1977
left a comment
There was a problem hiding this comment.
Thanks @janblumenkamp for the fixes!
|
Sorry for not responding to zseymours review earlier! Thanks for merging, Sven. Out of curiosity, how was the point raised in the review fixed eventually? It doesn't seem to be fixed in master. |
…ray-project#12846) * return tuple returned from _get_multi_action_distribution when using custom action dict * Always return dst_class and required_model_output_shape in _get_multi_action_distribution * pass model config to _get_multi_action_distribution
…ribution (ray-project#12846)" This reverts commit 7889b84.
Why are these changes needed?
Previously, when a custom action distribution is defined,
ModelCatalog._get_multi_action_distributionwas assigned todist_cls, which later is returned as tuple together withdist_cls.required_model_output_shape. This tuple is already returned from_get_multi_action_distributionthough, so it can directly be returned fromget_action_dist.Related issue number
None
Checks
scripts/format.shto lint the changes in this PR.