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

AttributeError and CPU usage #4

Closed IbrahimSobh closed 7 years ago

IbrahimSobh commented 7 years ago

Dear

After I installed everything

and then: python main.py --env-name "PongDeterministic-v3" --num-processes 8

I got this message:

File "/home/ubuntu/Notebooks/pytorch-a3c/train.py", line 24, in train shared_param.grad.data = param.grad.data AttributeError: 'NoneType' object has no attribute 'data'

However the code seems to run:

Time 00h 00m 03s, episode reward -21.0, episode length 764 Time 00h 01m 07s, episode reward -21.0, episode length 764 Time 00h 02m 11s, episode reward -21.0, episode length 764 Time 00h 03m 14s, episode reward -21.0, episode length 764 Time 00h 04m 18s, episode reward -21.0, episode length 764 Time 00h 05m 22s, episode reward -21.0, episode length 764 Time 00h 06m 25s, episode reward -21.0, episode length 764 Time 00h 07m 29s, episode reward -21.0, episode length 764 ......

But the CPU is always 0% and some times peaks at 400~500%

Is this normal? (I think only the evaluation thread is running!)

Thank you so much for your efforts

ethancaballero commented 7 years ago

@IbrahimSobh Read this: https://github.com/ikostrikov/pytorch-a3c/pull/7#issue-214008005

ikostrikov commented 7 years ago

Fixed it in a recent commit: https://github.com/ikostrikov/pytorch-a3c/commit/15dd5e55e42c0847b55fb6b0a13faae498c3190c