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

fix: shared weights with agent type #428

Merged
merged 8 commits into from
Mar 1, 2022
Merged

Conversation

AsadJeewa
Copy link
Contributor

@AsadJeewa AsadJeewa commented Feb 23, 2022

What?

Updated agent network types to only share weights between agent types
#427

Why?

When setting shared_weights to true, a single network is created for all agents. It should not be possible to share weights across agent types

How?

changed self._agent_net_keys in systems.py to assign the correct keys (for MADQN, MAPPO, MADDPG)

Extra

If we are happy with this change, would we then need to benchmark?

@AsadJeewa AsadJeewa added the bug Something isn't working label Feb 23, 2022
@AsadJeewa AsadJeewa added this to the Mava stable systems release milestone Feb 23, 2022
@AsadJeewa AsadJeewa self-assigned this Feb 23, 2022
@AsadJeewa AsadJeewa linked an issue Feb 23, 2022 that may be closed by this pull request
3 tasks
Copy link
Collaborator

@arnupretorius arnupretorius left a comment

Choose a reason for hiding this comment

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

Thanks @AsadJeewa! 😄

Just see my few comments. Also, did we test this? At the very least we should do some runs on environments with and without different agent types.

mava/systems/tf/maddpg/system.py Outdated Show resolved Hide resolved
mava/systems/tf/mappo/system.py Outdated Show resolved Hide resolved
@AsadJeewa
Copy link
Contributor Author

I tested that everything works in multiple different environments with different (openspiel Tic Tac Toe, Petting Zoo Pong) or single-agent types (debugging, Petting Zoo Multiwalker, Flatland) to make sure that the networks were being assigned correctly and that execution proceeds. Since shared_weights default value is True, I think that we should run a small set of benchmarks @RuanJohn

Copy link
Contributor

@mmorris44 mmorris44 left a comment

Choose a reason for hiding this comment

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

  • 1 potential issue in 3 places
  • 1 debug print statement
  • 1 minor comment

mava/systems/tf/maddpg/system.py Show resolved Hide resolved
mava/systems/tf/madqn/system.py Show resolved Hide resolved
mava/systems/tf/madqn/system.py Outdated Show resolved Hide resolved
mava/systems/tf/mappo/system.py Show resolved Hide resolved
@AsadJeewa
Copy link
Contributor Author

AsadJeewa commented Feb 24, 2022

This line (https://github.com/instadeepai/Mava/blob/develop/mava/specs.py#L68) assumes that all environments will follow the naming convention of type_identifier but this is not always the case e.g. OpenSpiel TicTacToe: agents are named player_0 and player_1 so Mava assumes they are the same type. I have created a separate issue for this (#434)

Copy link
Contributor

@mmorris44 mmorris44 left a comment

Choose a reason for hiding this comment

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

PR looks good to go from my side.
Thanks @AsadJeewa!

Copy link
Collaborator

@arnupretorius arnupretorius left a comment

Choose a reason for hiding this comment

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

Thanks @AsadJeewa! 👍

@AsadJeewa AsadJeewa merged commit f83f125 into develop Mar 1, 2022
@AsadJeewa AsadJeewa deleted the bugfix/shared_weights branch March 1, 2022 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Shared weights across agent types
3 participants