pytorch-distributed
pytorch-distributed copied to clipboard
Ape-X DQN & DDPG with pytorch & tensorboard
Distributed Deep Reinforcement Learning with
pytorch & tensorboard
- Sample on-line plotting while training a Distributed DQN agent on Pong (
nstepmeans lookahead this many steps when bootstraping the target q values):- blue:
num_actors=2, nstep=1 - orange:
num_actors=8, nstep=1 - grey:
num_actors=8, nstep=5
- blue:

What is included?
This repo currently contains the following agents:
Code structure:
NOTE: we follow the same code structure as pytorch-rl& pytorch-dnc.
./utils/factory.py
We suggest the users refer to
./utils/factory.py, where we list all the integratedEnv,Model,Memory,AgentintoDict's. All of those four core classes are implemented in./core/. The factory pattern in./utils/factory.pymakes the code super clean, as no matter what type ofAgentyou want to train, or which type ofEnvyou want to train on, all you need to do is to simply modify some parameters in./utils/options.py, then the./main.pywill do it all (NOTE: this./main.pyfile never needs to be modified).
./core/single_processes/.
Each agent contains
4types ofsingle_process's:
Logger: plotGlobal/Actor/Learner/EvaluatorLogsontotensorboardActor: collect experiences fromEnvand push to a global sharedMemoryLearner: samples from the global sharedMemoryand do DRL updates on theModelEvaluator: evaluate theModelduring training
How to run:
You only need to modify some parameters in ./utils/options.py to train a new configuration.
- Configure your training in
./utils/options.py:
line 13: add an entry intoCONFIGSto define your training (agent_type,env_type,game,memory_type,model_type)line 23: choose the entry ID you just addedline 19-20: fill in your machine/cluster ID (MACHINE) and timestamp (TIMESTAMP) to define your training signature (MACHINE_TIMESTAMP), the corresponding model file of this training will be saved under this signature (./models/MACHINE_TIMESTAMP.pth). Also the tensorboard visualization will be displayed under this signature (first activate the tensorboard server by type in bash:tensorboard --logdir logs/, then open this address in your browser:http://localhost:6006/)line 22: to train a model, setmode=1(training visualization will be underhttp://localhost:6006/); to test the model of this current training, all you need to do is to setmode=2.
- Run:
python main.py
Dependencies:
- Python 3
- PyTorch >=v0.4.0
- tensorboard-pytorch
- atari-py
Repos we referred to during the development of this repo:
This repo is developed together w/ @onlytailei.