The imitation library implements imitation learning algorithms on top of Stable-Baselines3, including:
It also provides CLI scripts for training and saving demonstrations from RL experts, and for training imitation learners on these demonstrations.
Installation requires Python 3.7+:
pip install imitation
# Train PPO agent on cartpole and collect expert demonstrations python -m imitation.scripts.expert_demos with fast cartpole log_dir=quickstart # Train GAIL from demonstrations python -m imitation.scripts.train_adversarial with fast gail cartpole rollout_path=quickstart/rollouts/final.pkl # Train AIRL from demonstrations python -m imitation.scripts.train_adversarial with fast airl cartpole rollout_path=quickstart/rollouts/final.pkl
You can remove the
fast option to run training to completion. For more CLI options
and information on reading Tensorboard plots, see the
Python Interface Quickstart¶
This example script uses the Python API to train BC, GAIL, and AIRL models on CartPole data.