Agent Learning Framework (ALF) is a reinforcement learning framework emphasizing on the flexibility and easiness of implementing complex algorithms involving many different components. ALF is built on PyTorch. The development of previous version based on Tensorflow 2.1 has been stopped.
- A2C: OpenAI Baselines: ACKTR & A2C
- DDPG: Lillicrap et al. "Continuous control with deep reinforcement learning" arXiv:1509.02971
- PPO: Schulman et al. "Proximal Policy Optimization Algorithms" arXiv:1707.06347
- SAC: Haarnoja et al. "Soft Actor-Critic Algorithms and Applications" arXiv:1812.05905
- ICM: Pathak et al. "Curiosity-driven Exploration by Self-supervised Prediction" arXiv:1705.05363
- MERLIN: Wayne et al. "Unsupervised Predictive Memory in a Goal-Directed Agent"arXiv:1803.10760
- Amortized SVGD: Feng et al. "Learning to Draw Samples with Amortized Stein Variational Gradient Descent"arXiv:1707.06626
- RND: Burda et al. "Exploration by Random Network Distillation" arXiv:1810.12894
- MINE: Belghazi et al. "Mutual Information Neural Estimation" arXiv:1801.04062
- DIAYN: Eysenbach et al. "Diversity is All You Need: Learning Diverse Skills without a Reward Function" arXiv:1802.06070
- MISC: Zhao et al. "Mutual Information-based State-Control for Intrinsically Motivated Reinforcement Learning" arXiv:2002.01963
- MuZero: Schrittwieser et. al. "Mastering Atari, Go, Chess and Shogi by Planning with a Learned Model" arXiv:1911.08265
You can run the following commands to install ALF
git clone https://github.com/HorizonRobotics/alf
cd alf
pip install -e .
All the examples below are trained on a single machine Intel(R) Core(TM) i9-7960X CPU @ 2.80GHz with 32 CPUs and one RTX 2080Ti GPU.
You can train model of the examples using the following command:
python -m alf.bin.train --gin_file=GIN_FILE --root_dir=LOG_DIR
- GIN_FILE is the file of gin configuration. You can find sample gin configuration files for different tasks under directory alf/examples (note that some of the examples have not been converted to use the latest pytorch version of ALF).
- LOG_DIR is the directory when you want to store the training results. Note that if you want to train from scratch, a new value for LOG_DIR need to be used. Othewise, it is assumed to resume the training from a previous checkpoint (if any).
During training, you can use tensorboard to show the progress of training:
tensorboard --logdir=LOG_DIR
After training, you can visualize the trained model using the following command:
python -m alf.bin.play --root_dir=LOG_DIR
-
Cart pole. The training score took only 30 seconds to reach 200, using 8 environments.
-
Atari games. Need to install python package atari-py for atari game environments. The evaluation score (by taking argmax of the policy) took 1.5 hours to reach 800 on Breakout, using 64 environments.
-
Simple navigation with visual input. Follow the instruction at SocialRobot to install the environment.
-
PR2 grasping state only. Follow the instruction at SocialRobot to install the environment.
-
Humanoid. Learning to walk using the pybullet Humanoid environment. Need to install python pybullet>=2.5.0 for the environment. The training score took 1 hour 40 minutes to reach 2k, using asynchronous training with 2 actors (192 environments).
-
FetchSlide (sparse rewards). Need to install the MuJoCo simulator first. This example reproduces the performance of vanilla DDPG reported in the OpenAI's Robotics environment paper. Our implementation doesn't use MPI, but obtains (evaluation) performance on par with the original implementation. (The original MPI implementation has 19 workers, each worker containing 2 environments for rollout and sampling a minibatch of size 256 from its replay buffer for computing gradients. All the workers' gradients will be summed together for a centralized optimizer step. Our implementation simply samples a minibatch of size 5000 from a common replay buffer per optimizer step.) The training took about 1 hour with 38 (19*2) parallel environments on a single GPU.
-
FetchReach (sparse rewards). Need to install the MuJoCo simulator first. The training took about 20 minutes with 20 parallel environments on a single GPU.
-
FetchSlide (sparse rewards). Need to install the MuJoCo simulator first. This is the same task with the DDPG example above, but with SAC as the learning algorithm. Also it has only 20 (instead of 38) parallel environments to improve sample efficiency. The training took about 2 hours on a single GPU.
-
Fetch Environments (sparse rewards) w/ Action Repeat. We are able to achieve even better performance than reported by DDPG + Hindsight Experience Replay in some cases simply by using SAC + Action Repeat with length 3 timesteps. See this note to view learning curves, videos, and more details.
-
Super Mario. Playing Super Mario only using intrinsic reward. Python package gym-retro>=0.7.0 is required for this experiment and also a suitable
SuperMarioBros-Nes
rom should be obtained and imported (roms are not included in gym-retro). See this doc on how to import roms.
- Montezuma's Revenge. Training the hard exploration game Montezuma's Revenge with intrinsic rewards generated by RND. A lucky agent can get an episodic score of 6600 in 160M frames (40M steps with
frame_skip=4
). A normal agent would get an episodic score of 4000~6000 in the same number of frames. The training took about 6.5 hours with 128 parallel environments on a single GPU.
-
Pendulum. Learning diverse skills without external rewards.
-
Collect Good Objects. Learn to collect good objects and avoid bad objects.
DeepmindLab
is required, Follow the instruction at DeepmindLab to install the environment.
-
Playground with a red ball and with two balls, a red ball and a blue ball. The agent learns to interact with the objects via the MI-based internal drive.
-
6x6 Go. It took about a day to train a reasonable agent to play 6x6 go using one GPU.