pytorch-a3c icon indicating copy to clipboard operation
pytorch-a3c copied to clipboard

Can't work on Ubuntu 16.04

Open caozhenxiang-kouji opened this issue 7 years ago • 22 comments

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?

caozhenxiang-kouji avatar Feb 07 '18 13:02 caozhenxiang-kouji

What version of pytorch do you use?

ikostrikov avatar Feb 07 '18 13:02 ikostrikov

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

caozhenxiang-kouji avatar Feb 07 '18 13:02 caozhenxiang-kouji

Did you install it with anaconda or build from sources?

ikostrikov avatar Feb 07 '18 13:02 ikostrikov

No, just pip3 setup.py install

caozhenxiang-kouji avatar Feb 07 '18 13:02 caozhenxiang-kouji

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)))

caozhenxiang-kouji avatar Feb 07 '18 13:02 caozhenxiang-kouji

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).

ikostrikov avatar Feb 07 '18 13:02 ikostrikov

Which version do you use on this project?

caozhenxiang-kouji avatar Feb 07 '18 13:02 caozhenxiang-kouji

0.3

ikostrikov avatar Feb 07 '18 13:02 ikostrikov

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

caozhenxiang-kouji avatar Feb 07 '18 13:02 caozhenxiang-kouji

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.

ikostrikov avatar Feb 07 '18 13:02 ikostrikov

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

caozhenxiang-kouji avatar Feb 07 '18 13:02 caozhenxiang-kouji

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

ikostrikov avatar Feb 07 '18 13:02 ikostrikov

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 avatar Feb 07 '18 15:02 caozhenxiang-kouji

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

caozhenxiang-kouji avatar Feb 08 '18 12:02 caozhenxiang-kouji

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

dragen1860 avatar Feb 22 '18 03:02 dragen1860

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

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

ikostrikov avatar Feb 22 '18 03:02 ikostrikov

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

jixian79 avatar Apr 27 '18 08:04 jixian79

has anyone solved this issue?

ShaniGam avatar Jun 28 '18 15:06 ShaniGam

@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

mynkpl1998 avatar Oct 28 '18 06:10 mynkpl1998

@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!

hudsontek avatar Jan 06 '21 21:01 hudsontek

Can I run this code in google colab?

mahmudpyjs avatar May 23 '22 17:05 mahmudpyjs

@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

akshaygulabrao avatar Feb 06 '23 21:02 akshaygulabrao