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

[Feature] Allow multipe inputs to models #73

Merged
merged 41 commits into from
Apr 8, 2024

Conversation

matteobettini
Copy link
Collaborator

@matteobettini matteobettini commented Apr 5, 2024

This PR allows multiple inputs to models (given from their input spec)

The current models will behave in the following way:

  • MLP will check that all inputs have the same shape up to the last dim and cat them before feeding them to the NN
  • GNN will to the same
  • CNN will accept 2 types of inputs: images and 1-dim tensors. It will cat the images and process them and then cat them to the tensors before the MLP layer

In this PR we move the concatenation of actions and state (that was happening in the SAC and DDPG algorithms) to the model by directly feeding both inputs

cc @ezhang7423

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 5, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 25 lines in your changes are missing coverage. Please review.

Project coverage is 53.83%. Comparing base (e6afcf5) to head (f4118c5).

Files Patch % Lines
benchmarl/models/cnn.py 88.88% 13 Missing ⚠️
benchmarl/models/common.py 60.00% 4 Missing ⚠️
benchmarl/models/mlp.py 76.92% 3 Missing ⚠️
benchmarl/models/gnn.py 81.81% 2 Missing ⚠️
benchmarl/algorithms/maddpg.py 0.00% 1 Missing ⚠️
benchmarl/algorithms/masac.py 0.00% 1 Missing ⚠️
test/test_models.py 97.72% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #73       +/-   ##
===========================================
- Coverage   89.99%   53.83%   -36.17%     
===========================================
  Files          69       70        +1     
  Lines        2739     2907      +168     
===========================================
- Hits         2465     1565      -900     
- Misses        274     1342     +1068     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@matteobettini matteobettini merged commit 3a9a40c into main Apr 8, 2024
13 checks passed
@matteobettini matteobettini deleted the multipe_inputs_to_models branch April 8, 2024 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants