tianshou  by thu-ml

PyTorch RL library for algorithm development and application

Created 7 years ago
8,779 stars

Top 5.8% on SourcePulse

GitHubView on GitHub
Project Summary

Tianshou is a comprehensive, modular, and high-performance deep reinforcement learning library built on PyTorch and Gymnasium. It targets both RL researchers seeking flexible, hackable interfaces for algorithm development and practitioners needing user-friendly tools for applying RL to custom environments. Tianshou offers a wide range of supported algorithms, including online, offline, and experimental multi-agent and model-based RL, aiming to enable concise and efficient implementations.

How It Works

Tianshou features a dual API design: a high-level, declarative API for ease of use in applications, and a low-level, procedural API for maximum flexibility in algorithm development. This modularity allows for easy integration of new algorithms and customization of training processes. It supports vectorized environments, recurrent state representations, and various state/action types, all while emphasizing performance through optimized components like Numba-compiled JIT operations for n-step returns and prioritized experience replay.

Quick Start & Requirements

  • Installation: poetry install (recommended for latest version) or pip install tianshou (PyPI, potentially outdated). Install extras like poetry install --extras "mujoco envpool" for specific functionalities.
  • Prerequisites: Python >= 3.11. Optional extras include atari, box2d, classic_control, mujoco, pybullet, robotics, vizdoom, envpool, argparse.
  • Documentation: tianshou.readthedocs.io
  • Examples: examples/ folder

Highlighted Details

  • Achieves state-of-the-art results in MuJoCo benchmarks for multiple algorithms.
  • Supports highly optimized vectorized environments via EnvPool.
  • Provides a general policy interface (__init__, forward, process_buffer, process_fn, learn, post_process_fn, update) for straightforward algorithm experimentation.
  • Offers comprehensive testing, including full agent training procedures, to ensure reproducibility.

Maintenance & Community

  • Supported by appliedAI Institute for Europe.
  • Actively developed with continuous addition of algorithms and features. Contribution guidelines are available.
  • Citations are encouraged via a JMLR publication.

Licensing & Compatibility

  • MIT License.
  • Compatible with commercial and closed-source applications.

Limitations & Caveats

  • The mujoco-py extra is for legacy compatibility and may have issues with newer macOS versions.
  • The PyPI installation is noted as being "far behind the master" branch.
Health Check
Last Commit

1 week ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
2
Star History
79 stars in the last 30 days

Explore Similar Projects

Starred by Deepak Pathak Deepak Pathak(Cofounder of Skild AI; Professor at CMU), Anastasis Germanidis Anastasis Germanidis(Cofounder of Runway), and
1 more.

deer by VinF

0%
489
Deep reinforcement learning framework
Created 9 years ago
Updated 2 months ago
Starred by Evan Hubinger Evan Hubinger(Head of Alignment Stress-Testing at Anthropic), Jiayi Pan Jiayi Pan(Author of SWE-Gym; MTS at xAI), and
1 more.

rl by pytorch

0.4%
3k
PyTorch library for reinforcement learning research
Created 3 years ago
Updated 2 days ago
Starred by Hanlin Tang Hanlin Tang(CTO Neural Networks at Databricks; Cofounder of MosaicML), Amanpreet Singh Amanpreet Singh(Cofounder of Contextual AI), and
2 more.

coach by IntelLabs

0%
2k
Reinforcement learning framework for experimentation (discontinued)
Created 8 years ago
Updated 2 years ago
Feedback? Help us improve.