Welcome to Tianshou!

Tianshou (天授) is a reinforcement learning platform based on pure PyTorch. Unlike existing reinforcement learning libraries, which are mainly based on TensorFlow, have many nested classes, unfriendly API, or slow-speed, Tianshou provides a fast-speed framework and pythonic API for building the deep reinforcement learning agent. The supported interface algorithms include:

Here is Tianshou’s other features:

  • Elegant framework, using only ~2000 lines of code

  • Support parallel environment sampling for all algorithms

  • Support recurrent state representation in actor network and critic network (RNN-style training for POMDP)

  • Support any type of environment state (e.g. a dict, a self-defined class, …)

  • Support n-step returns estimation compute_nstep_return() for all Q-learning based algorithms

中文文档位于 https://tianshou.readthedocs.io/zh/latest/


Tianshou is currently hosted on PyPI. You can simply install Tianshou with the following command (with Python >= 3.6):

pip3 install tianshou

You can also install with the newest version through GitHub:

pip3 install git+https://github.com/thu-ml/tianshou.git@master

If you use Anaconda or Miniconda, you can install Tianshou through the following command lines:

# create a new virtualenv and install pip, change the env name if you like
conda create -n myenv pip
# activate the environment
conda activate myenv
# install tianshou
pip install tianshou

After installation, open your python console and type

import tianshou as ts

If no error occurs, you have successfully installed Tianshou.

Tianshou is still under development, you can also check out the documents in stable version through tianshou.readthedocs.io/en/stable/.

Indices and tables