facebookresearch / BenchMARL

A collection of MARL benchmarks based on TorchRL
https://benchmarl.readthedocs.io/
MIT License
191 stars 23 forks source link

Vmas/Kinematic Bicycle #56

Closed prinshul closed 5 months ago

prinshul commented 5 months ago

Error executing job with overrides: ['algorithm=mappo', 'task=vmas/debug/kinematic_bicycle'] Traceback (most recent call last): File "/hdd3/marl_new/new_bench_marl/BenchMARL/fine_tuned/vmas/vmas_run.py", line 25, in hydra_experiment experiment: Experiment = load_experiment_from_hydra(cfg, task_name=task_name) File "/hdd3/marl_new/new_bench_marl/BenchMARL/benchmarl/hydra_config.py", line 37, in load_experiment_from_hydra return Experiment( File "/hdd3/marl_new/new_bench_marl/BenchMARL/benchmarl/experiment/experiment.py", line 324, in init self._setup() File "/hdd3/marl_new/new_bench_marl/BenchMARL/benchmarl/experiment/experiment.py", line 344, in _setup self._setup_algorithm() File "/hdd3/marl_new/new_bench_marl/BenchMARL/benchmarl/experiment/experiment.py", line 421, in _setup_algorithm self.losses = { File "/hdd3/marl_new/new_bench_marl/BenchMARL/benchmarl/experiment/experiment.py", line 422, in group: self.algorithm.get_loss_and_updater(group)[0] File "/hdd3/marl_new/new_bench_marl/BenchMARL/benchmarl/algorithms/common.py", line 122, in get_loss_and_updater policy_for_loss=self.get_policy_for_loss(group), File "/hdd3/marl_new/new_bench_marl/BenchMARL/benchmarl/algorithms/common.py", line 183, in get_policy_for_loss group: self._get_policy_for_loss( File "/hdd3/marl_new/new_bench_marl/BenchMARL/benchmarl/algorithms/mappo.py", line 141, in _get_policy_for_loss actor_module = model_config.get_model( File "/hdd3/marl_new/new_bench_marl/BenchMARL/benchmarl/models/common.py", line 250, in get_model return self.associated_class()( File "/hdd3/marl_new/new_bench_marl/BenchMARL/benchmarl/models/mlp.py", line 55, in init self.mlp = MultiAgentMLP( File "/home/iitdpc/miniconda3/envs/mb_meta/lib/python3.10/site-packages/torchrl/modules/models/multiagent.py", line 162, in init [ File "/home/iitdpc/miniconda3/envs/mb_meta/lib/python3.10/site-packages/torchrl/modules/models/multiagent.py", line 163, in MLP( File "/home/iitdpc/miniconda3/envs/mb_meta/lib/python3.10/site-packages/torchrl/modules/models/models.py", line 214, in init layers = self._make_net(device) File "/home/iitdpc/miniconda3/envs/mb_meta/lib/python3.10/site-packages/torchrl/modules/models/models.py", line 225, in _make_net create_on_device( File "/home/iitdpc/miniconda3/envs/mb_meta/lib/python3.10/site-packages/torchrl/modules/models/utils.py", line 122, in create_on_device return module_class(*args, device=device, kwargs) File "/home/iitdpc/miniconda3/envs/mb_meta/lib/python3.10/site-packages/torch/nn/modules/linear.py", line 96, in init self.weight = Parameter(torch.empty((out_features, in_features), factory_kwargs)) RuntimeError: Trying to create tensor with negative dimension -2: [-2, 256]

prinshul commented 5 months ago

Exactly the same error with vmas/debug/diff_drive.

matteobettini commented 5 months ago

You need to install torchrl main i think.

some stuff is fixed in the most recent versions

prinshul commented 5 months ago

You need to install torchrl main i think.

some stuff is fixed in the most recent versions

Current torchrl version 0.2.1 I think that's the recent one. Do you recommend installing it from the source (GitHub repo)?

matteobettini commented 5 months ago

Yes from source. like this https://github.com/facebookresearch/BenchMARL/blob/280a85bb2747f4ce9735fad6b862426ea478ebf9/.github/unittest/install_dependencies.sh#L10-L14

matteobettini commented 5 months ago

Did this fix your issue?

prinshul commented 5 months ago

Sorry unfortunately the suggested fix was giving more errors. So I was unable to.

matteobettini commented 5 months ago

Are you using the latest version of both vmas and torchrl?

prinshul commented 5 months ago

Yes, I used the latest version at that time. Currently, I am not looking into it due to other engagements.

matteobettini commented 5 months ago

To show that it is possible to train those tasks (even though they are not included in the benchmarl pool of tasks) I have created a dedicated branch: https://github.com/facebookresearch/BenchMARL/tree/diff_drive

To train the diff_drive scenario, clone the repository, check out that branch and

Install requirements

pip install torchrl
pip install git+https://github.com/proroklab/VectorizedMultiAgentSimulator.git
pip install -e .

Run with

python fine_tuned/vmas/vmas_run.py
prinshul commented 5 months ago

Thank you so much.