GithubHelp home page GithubHelp logo

ikostrikov / pytorch-ddpg-naf Goto Github PK

View Code? Open in Web Editor NEW
304.0 10.0 72.0 37 KB

Implementation of algorithms for continuous control (DDPG and NAF).

License: MIT License

Python 100.00%
pytorch reinforcement-learning deep-learning ddpg deep-deterministic-policy-gradient

pytorch-ddpg-naf's People

Contributors

gntoni avatar gsp-27 avatar ikostrikov2 avatar kazuotani14 avatar pranz24 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  avatar  avatar  avatar  avatar  avatar

pytorch-ddpg-naf's Issues

Having trouble running code with HalfCheetah

I tried running the code with HalfCheetah and commented out the wrappers.Monitor(...) line and any line that rendered the result. I get the error:

Traceback (most recent call last):
File "main.py", line 98, in
agent.update_parameters(batch)
File "/home/sbhupatiraju/pytorch-ddpg-naf/naf.py", line 126, in update_parameters
loss.backward()
File "/home/sbhupatiraju/anaconda3/lib/python3.6/site-packages/torch/autograd/variable.py", line 156, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, retain_variables)
File "/home/sbhupatiraju/anaconda3/lib/python3.6/site-packages/torch/autograd/init.py", line 98, in backward
variables, grad_variables, retain_graph)
RuntimeError: element 0 of variables tuple is volatile

Any idea on what might be going on?

AttributeError for gradient clipping

hi ikostrikov, I got this error when running your code

Traceback (most recent call last):
  File "main.py", line 89, in <module>
    agent.update_parameters(batch)
  File "/home/andrewliao11/Work/pytorch-naf/naf.py", line 121, in update_parameters
    param.grad.data.clamp(-1, 1)
AttributeError: 'NoneType' object has no attribute 'data'

the original code is:

for param in self.model.parameters():
            param.grad.data.clamp(-1, 1)

maybe we should modify in into:

torch.nn.utils.clip_grad_norm(self.model.parameters(), 1)

I'm just a newbie to pytorch, not sure if it's right, thx!

NAF Implementation not working!

The NAF algorithm does not work on Pendulum or any of the PyBullet environments. @ikostrikov Do you have any guesses why that might be the case? Which environments did you experiment with this code on? In case you used different hyperparameters than the default values, could you mention the changes that need to be made to get the NAF algorithm working.

Parallel OpenAI environments

Hi, I was wondering if there is any particular reason why this repo doesn't use parallel environments like those in the a2c-ppo-acktr repo.

benchmarking the repo

Hi @ikostrikov ,
I appreciate your implementation, and I wonder if you've benchmarked your implementation?
If so, can I have some roughly results. Many thanks!

Error out of memory

Hi,

I am doing some work about RL, and very interested in the two algorithms. I have tried to train your models both on CPU and GPU, however, both outputted "out of memory" error. The memory in use was keeping increasing.
It seems that the data and/or the model in former steps are not released . And the code is very similar to the example, as follows:

    action = agent.select_action(state, ounoise, param_noise)
    next_state, reward, done, info = env.step(action.cpu().numpy()[0])
    total_numsteps += 1
    episode_reward += reward

    action = torch.Tensor(action.cpu())
    mask = torch.Tensor([not done])
    next_state = torch.Tensor(next_state.cpu())
    reward = torch.Tensor([reward])

    # pdb.set_trace()
    memory.push(state, action, mask, next_state, reward)
    state = next_state

    if len(memory) > args.batch_size:
        for _ in range(args.updates_per_step):
            transitions = memory.sample(args.batch_size)
            batch = Transition(*zip(*transitions))

            value_loss, policy_loss = agent.update_parameters(batch)

            writer.add_scalar('loss/value', value_loss, updates)
            writer.add_scalar('loss/policy', policy_loss, updates)

            updates += 1

Would you please help to solve the problem? Thanks in advance

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.