ikostrikov / pytorch-a3c

PyTorch implementation of Asynchronous Advantage Actor Critic (A3C) from "Asynchronous Methods for Deep Reinforcement Learning".
MIT License
1.23k stars 279 forks source link

Can't work on Ubuntu 16.04 #46

Open caozhenxiang-kouji opened 6 years ago

caozhenxiang-kouji commented 6 years ago

After value, logit, (hx, cx) = model((Variable(state.unsqueeze(0)),(hx, cx))) in train.py, the program doesn't go on. Do you have any idea?

ikostrikov commented 6 years ago

What version of pytorch do you use?

caozhenxiang-kouji commented 6 years ago

The latest one, I just downloaded it from Github several hours ago. I don't know the exact version.

ikostrikov commented 6 years ago

Did you install it with anaconda or build from sources?

caozhenxiang-kouji commented 6 years ago

No, just pip3 setup.py install

caozhenxiang-kouji commented 6 years ago

There's also warnings like this one, I 'not sure if it matters. /home/user/RL/pytorch-a3c/test.py:44: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. state.unsqueeze(0), volatile=True), (hx, cx)))

ikostrikov commented 6 years ago

Try to use a stable release.

They are going to introduce a lot of changes in the more recent version (the one that is currently developed in the master branch).

caozhenxiang-kouji commented 6 years ago

Which version do you use on this project?

ikostrikov commented 6 years ago

0.3

caozhenxiang-kouji commented 6 years ago

I notice that your network is different from the network from the original paper of the DeepMind. Does it work better?

ikostrikov commented 6 years ago

I'm using the architecture from open ai universe starter.

It works similarly. But it was easier to use it because they provide all hyper parameters.

caozhenxiang-kouji commented 6 years ago

I can't find a 0.3 version. Does 0.2 work as well?

ikostrikov commented 6 years ago

Check the instructions in pytorch.org. There is 0.3 there.

caozhenxiang-kouji commented 6 years ago

I've installed 0.3, but the problem still exists. When I change no-shared to True, the program works just fine. Do you have any idea about this?

caozhenxiang-kouji commented 6 years ago

Have you tried training with no-shared=True? I tried it last night, but it's really hard to converge

dragen1860 commented 6 years ago

any one tried in cuda()? I found the program stuck at x = F.elu(self.conv1(inputs))

ikostrikov commented 6 years ago

@dragen1860 it's designed specifically to be efficient on CPU.

For a GPU optimized code see http://github.com/ikostrikov/pytorch-a2c-ppo-acktr

jixian79 commented 6 years ago

i have the same problem. Ubuntu16.04 Anaconda pytorch0.3.1

ShaniGam commented 6 years ago

has anyone solved this issue?

mynkpl1998 commented 6 years ago

@dragen1860 I was having the same problem. Adding this line in the main script solved my problem.


if __name__ == "__main__":

    mp.set_start_method("spawn")

    os.environ["OMP_NUM_THREADS"] = "1" # make sure numpy uses only one thread for each process
    os.environ["CUDA_VISABLE_DEVICES"] = "" # make sure not to use gpu
hudsontek commented 3 years ago

@dragen1860 I was having the same problem. Adding this line in the main script solved my problem.


if __name__ == "__main__":

  mp.set_start_method("spawn")

  os.environ["OMP_NUM_THREADS"] = "1" # make sure numpy uses only one thread for each process
  os.environ["CUDA_VISABLE_DEVICES"] = "" # make sure not to use gpu

Two years later, your answer still helps! Thanks!

mahmudpyjs commented 2 years ago

Can I run this code in google colab?

akshaygulabrao commented 1 year ago

@dragen1860 I was having the same problem. Adding this line in the main script solved my problem.


if __name__ == "__main__":

  mp.set_start_method("spawn")

  os.environ["OMP_NUM_THREADS"] = "1" # make sure numpy uses only one thread for each process
  os.environ["CUDA_VISABLE_DEVICES"] = "" # make sure not to use gpu

thank you so much, for me this only worked until I uninstalled the cuda driver