Coder Social home page Coder Social logo

philtabor / multi-agent-deep-deterministic-policy-gradients Goto Github PK

View Code? Open in Web Editor NEW
267.0 5.0 68.0 8 KB

A Pytorch implementation of the multi agent deep deterministic policy gradients (MADDPG) algorithm

Python 100.00%
reinforcement-learning actor-critic-methods maddpg multi-agent-reinforcement-learning deep-reinforcement-learning actor-critic-algorithm

multi-agent-deep-deterministic-policy-gradients's People

Contributors

philtabor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

multi-agent-deep-deterministic-policy-gradients's Issues

ValueError: could not broadcast input array from shape (8) into shape (28)

File "maddpg_torch.py", line 345, in
memory.store_transition(obs, state, actions, reward, obs_, state_, done)
File "maddpg_torch.py", line 51, in store_transition
self.state_memory[index] = state
ValueError: could not broadcast input array from shape (8) into shape (28)

This error occurs when scenario='simple_adversary' in main
when scenario='simple ', this error will not occur

Found dtype Float but expected Double

Hello dear,
i'm trying to run the code (after your correction on backward) but i'm getting the following error:
I also tried with python 3.6 (numpy 1.14.5 , torch 1.10.1, gym 0.10.5), i'm still getting the same error

critic_loss.backward(retain_graph=True)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/torch/_tensor.py", line 307, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/torch/autograd/__init__.py", line 154, in backward
    Variable._execution_engine.run_backward(
RuntimeError: Found dtype Float but expected Double

it seems like the error is being raised from the method MADDPG.learn at :
critic_loss.backward(retain_graph=True)
i checked the variable of "target" variable and has dtype=torch.float64
Any idea ? thanks

Question about backward

Hi Phil,

I have watched your video on Youtube. There's still a question about the critic_loss.backward(retain_graph=True). In your solution, you just turn the torch version from 1.8.1 to 1.4, I think it's a bug in version 1.4 and so that you are running bug-free in version 1.4.

I have checked a lot of information but I still don't know how to solve it. So here I am to turn to you.
Here is my Traceback:

File "main.py", line 101, in <module>
    maddpg_agent.learn(memory)
  File "maddpg.py", line 99, in learn
    critic_loss.backward(retain_graph=True)
  File "/usr/local/lib/python3.7/dist-packages/torch/tensor.py", line 245, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
  File "/usr/local/lib/python3.7/dist-packages/torch/autograd/__init__.py", line 147, in backward
    allow_unreachable=True, accumulate_grad=True)  # allow_unreachable flag
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [64, 8]], which is output 0 of TBackward, is at version 3; expected version 2 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

ModuleNotFoundError: No module named 'make_env'

When I run the code, the following error appears, showing that the make_env module is missing,how to solve this problem?
Traceback (most recent call last):
File "F:\project\pytorch\edge computing\Multi-Agent-Deep-Deterministic-Policy-Gradients-master\main.py", line 4, in
from make_env import make_env
ModuleNotFoundError: No module named 'make_env'

Shouldn't it be agent.actor.forward() and calculate actor_loss?

actor_loss = agent.critic.forward(states, mu).flatten()

Dear Phill,

First of all plenty of thanks and gratitude for your lessens, I've learned a lot from your lectures.
I've noticed a difference in the code at line 83 in MADDPG class while calculating actor-loss. It's running forward propagation of critic network instead of actor network. I believe this is typo, please correct me if I'm wrong.

Thanks and Regards
Viji

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.