dgriff777 / rl_a3c_pytorch

A3C LSTM Atari with Pytorch plus A3G design
Apache License 2.0
562 stars 119 forks source link

watching game visualization during training #22

Closed rbunn80110 closed 6 years ago

rbunn80110 commented 6 years ago

I looked through all the arguments and I don't see one that allows you to watch the game being played while training. I guess I must be missing something really obvious. Great work by the way!

rbunn80110 commented 6 years ago

I think I figured it out, but let me know if I did it wrong somehow.

put this as an arg in main.py:


parser.add_argument(
    '--render',
    default=True,
    metavar='R',
    help='Watch game as it being played')

Then add this under the while True loop in train and test.py:

        if args.render:
            player.env.render()
rbunn80110 commented 6 years ago

After playing around with it, it appears that it works better when the code is added to test but not train.

dgriff777 commented 6 years ago

Yup just like it in the gym_eval.py script that works. Yes if you want while while training just put in this the test not the train. That should be preferable too as too watch the train workers would slow down too much. If you really want to see a training agent just put the same code in train and get rid of test render and also make sure to specify only one worker to render. The environment can't handle multiprocessing and rendering game. Its a gym environment issue