This project aims to provide clean implementations of imitation learning algorithms. Currently we have implementations of AIRL and GAIL, and intend to add more in the future.
conda create -n imitation python=3.7
conda activate imitation
pip install -e '.[dev]' # install `imitation` in developer mode
Follow instructions to install mujoco_py v1.5 here.
# Train PPO agent on cartpole and collect expert demonstrations
python -m imitation.scripts.expert_demos with cartpole
# Train AIRL on from demonstrations
python -m imitation.scripts.train_adversarial with cartpole airl
View Tensorboard with tensorboard --logdir output/
.
Please follow a coding style of:
- PEP8, with line width 88.
- Use the
black
autoformatter. - Follow the Google Python Style Guide unless it conflicts with the above. Examples of Google-style docstrings can be found here.
PRs should include unit tests for any new features, and add type annotations where possible. It is OK to omit annotations when it would make the code significantly more complex.
We use pytest
for unit testing: run pytest tests/
to run the test suite.
We use pytype
for static type analysis.
You should run ci/code_checks.sh
to run linting and static type checks, and may wish
to configure this as a Git pre-commit hook.
These checks are run on CircleCI and are required to pass before merging.
Additionally, we track test coverage by CodeCov, and mandate that code coverage
should not decrease. This can be overridden by maintainers in exceptional cases.
Files in imitation/{examples,scripts}/
have no coverage requirements.