Skip to content
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] MultiAgentEpisode add module_for API. #44241

Merged

Conversation

sven1977
Copy link
Contributor

@sven1977 sven1977 commented Mar 22, 2024

MultiAgentEpisode add module_for([agent ID]) API.

Users currently have no means to trigger an agent-to-module mapping within a MultiAgentEpisode before the agent has entered the episode (has its SingleAgentEpisode created).

A new API: MultiAgentEpisode.module_for (analogous to the old Episode(V2).policy_for() API) fixes this issue.

Why are these changes needed?

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
Copy link
Collaborator

@simonsays1980 simonsays1980 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -177,6 +177,11 @@ def __init__(
AlgorithmConfig.DEFAULT_AGENT_TO_MODULE_MAPPING_FN
)
self.agent_to_module_mapping_fn = agent_to_module_mapping_fn
# In case a user - e.g. via callbacks - already forces a mapping to happen
# via the `module_for()` API even before the agent has entered the episode
# (and has its SingleAgentEpisode created), we store all aldeary done mappings
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"aldeary" -> "already"

@sven1977 sven1977 merged commit b0250bf into ray-project:master Mar 22, 2024
5 checks passed
stephanie-wang pushed a commit to stephanie-wang/ray that referenced this pull request Mar 27, 2024
@sven1977 sven1977 deleted the multi_agent_episode_add_module_for_api branch April 2, 2024 09:53
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants