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

Ray: Support multiple policies #104

Open
florin-pop opened this issue Jun 11, 2024 · 2 comments
Open

Ray: Support multiple policies #104

florin-pop opened this issue Jun 11, 2024 · 2 comments

Comments

@florin-pop
Copy link

florin-pop commented Jun 11, 2024

Hello,

The ray example was super helpful in getting things up and running, however, when I tried to configure the PPOTrainer to use one policy per agent, the wrapper provided by VMAS could not be used as is.

My configuration:

"multiagent": {
    "policies": {
        f"agent_{i}": (PPOTorchPolicy, None, None, {})
        for i in range(n_agents)
    },
    "policy_mapping_fn": lambda agent_id: f"agent_{agent_id}",
},

The error:

ValueError: Have multiple policies {}, but the env <vmas.simulator.environment.rllib.VectorEnvWrapper object at 0x71ec0c8dcbb0> is not a subclass of BaseEnv, MultiAgentEnv, ActorHandle, or ExternalMultiAgentEnv!

PS: I'm not 100% sure if this is a feature request or a misuse from my side, as I was trying to make each agent have its own policy and not share the policy model across the agents.

@matteobettini
Copy link
Member

Yes so unfortunately by default vmas is not compatible with the Multiagent interface of RLLib because rllib does not allow to subclass both VectorEnv and MultiAgentEnv (a genius choice, I know).

So I went with subclassing only VectorEnv.

If you want to see how we use vmas multiagent in rllib with the option to share or not policy and critics see https://github.com/proroklab/HetGPPO

@matteobettini
Copy link
Member

matteobettini commented Jun 11, 2024

Here was my attempt to poke them about this ray-project/ray#26006 which ended into the void of the stale bot.

After this, I made my own https://github.com/facebookresearch/BenchMARL training library ;)

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

No branches or pull requests

2 participants