MCPcopy
hub / github.com/opendilab/DI-engine

github.com/opendilab/DI-engine @v0.5.3 sqlite

repository ↗ · DeepWiki ↗ · release v0.5.3 ↗
8,103 symbols 43,350 edges 1,648 files 3,478 documented · 43%
README
<a href="https://di-engine-docs.readthedocs.io/en/latest/"><img width="1000px" height="auto" src="https://github.com/opendilab/DI-engine-docs/blob/main/source/images/head_image.png"></a>

Twitter PyPI Conda Conda update PyPI - Python Version PyTorch Version

Loc Comments

Style Read en Docs Read zh_CN Docs Unittest Algotest deploy codecov

GitHub Org's stars GitHub stars GitHub forks GitHub commit activity GitHub issues GitHub pulls Contributors GitHub license Hugging Face Open in OpenXLab discord badge slack badge

Featured|HelloGitHub

Updated on 2024.12.23 DI-engine-v0.5.3

Introduction to DI-engine

Documentation | 中文文档 | Tutorials | Feature | Task & Middleware | TreeTensor | Roadmap

DI-engine is a generalized decision intelligence engine for PyTorch and JAX.

It provides python-first and asynchronous-native task and middleware abstractions, and modularly integrates several of the most important decision-making concepts: Env, Policy and Model. Based on the above mechanisms, DI-engine supports various deep reinforcement learning algorithms with superior performance, high efficiency, well-organized documentation and unittest:

  • Most basic DRL algorithms: such as DQN, Rainbow, PPO, TD3, SAC, R2D2, IMPALA
  • Multi-agent RL algorithms: such as QMIX, WQMIX, MAPPO, HAPPO, ACE
  • Imitation learning algorithms (BC/IRL/GAIL): such as GAIL, SQIL, Guided Cost Learning, Implicit BC
  • Offline RL algorithms: BCQ, CQL, TD3BC, Decision Transformer, EDAC, Diffuser, Decision Diffuser, SO2
  • Model-based RL algorithms: SVG, STEVE, MBPO, DDPPO, DreamerV3
  • Exploration algorithms: HER, RND, ICM, NGU
  • LLM + RL Algorithms: PPO-max, DPO, PromptPG, PromptAWR
  • Other algorithms: such as PER, PLR, PCGrad
  • MCTS + RL algorithms: AlphaZero, MuZero, please refer to LightZero
  • Generative Model + RL algorithms: Diffusion-QL, QGPO, SRPO, please refer to GenerativeRL

DI-engine aims to standardize different Decision Intelligence environments and applications, supporting both academic research and prototype applications. Various training pipelines and customized decision AI applications are also supported:

(Click to Collapse)

  • Traditional academic environments
  • DI-zoo: various decision intelligence demonstrations and benchmark environments with DI-engine.
  • Tutorial courses
  • PPOxFamily: PPO x Family DRL Tutorial Course
  • Real world decision AI applications
  • DI-star: Decision AI in StarCraftII
  • PsyDI: Towards a Multi-Modal and Interactive Chatbot for Psychological Assessments
  • DI-drive: Auto-driving platform
  • DI-sheep: Decision AI in 3 Tiles Game
  • DI-smartcross: Decision AI in Traffic Light Control
  • DI-bioseq: Decision AI in Biological Sequence Prediction and Searching
  • DI-1024: Deep Reinforcement Learning + 1024 Game
  • Research paper
  • InterFuser: [CoRL 2022] Safety-Enhanced Autonomous Driving Using Interpretable Sensor Fusion Transformer
  • ACE: [AAAI 2023] ACE: Cooperative Multi-agent Q-learning with Bidirectional Action-Dependency
  • GoBigger: [ICLR 2023] Multi-Agent Decision Intelligence Environment
  • DOS: [CVPR 2023] ReasonNet: End-to-End Driving with Temporal and Global Reasoning
  • LightZero: [NeurIPS 2023 Spotlight] A lightweight and efficient MCTS/AlphaZero/MuZero algorithm toolkit
  • SO2: [AAAI 2024] A Perspective of Q-value Estimation on Offline-to-Online Reinforcement Learning
  • LMDrive: [CVPR 2024] LMDrive: Closed-Loop End-to-End Driving with Large Language Models
  • SmartRefine: [CVPR 2024] SmartRefine: A Scenario-Adaptive Refinement Framework for Efficient Motion Prediction
  • ReZero: Boosting MCTS-based Algorithms by Backward-view and Entire-buffer Reanalyze
  • UniZero: Generalized and Efficient Planning with Scalable Latent World Models
  • Docs and Tutorials
  • DI-engine-docs: Tutorials, best practice and the API reference.
  • awesome-model-based-RL: A curated list of awesome Model-Based RL resources
  • awesome-exploration-RL: A curated list of awesome exploration RL resources
  • awesome-decision-transformer: A curated list of Decision Transformer resources
  • awesome-RLHF: A curated list of reinforcement learning with human feedback resources
  • awesome-multi-modal-reinforcement-learning: A curated list of Multi-Modal Reinforcement Learning resources
  • awesome-diffusion-model-in-rl: A curated list of Diffusion Model in RL resources
  • awesome-ui-agents: A curated list of of awesome UI agents resources, encompassing Web, App, OS, and beyond
  • awesome-AI-based-protein-design: a collection of research papers for AI-based protein design
  • awesome-end-to-end-autonomous-driving: A curated list of awesome End-to-End Autonomous Driving resources
  • awesome-driving-behavior-prediction: A collection of research papers for Driving Behavior Prediction

On the low-level end, DI-engine comes with a set of highly re-usable modules, including RL optimization functions, PyTorch utilities and auxiliary tools.

BTW, DI-engine also has some special system optimization and design for efficient and robust large-scale RL training:

(Click for Details)

Have fun with exploration and exploitation.

Outline

Installation

You can simply install DI-engine from PyPI with the following command:

pip install DI-engine

For more information about installation, you can refer to installation.

And our dockerhub repo can be found here,we prepare base image and env image with common RL environments.

(Click for Details)

  • base: opendilab/ding:nightly
  • rpc: opendilab/ding:nightly-rpc
  • atari: opendilab/ding:nightly-atari
  • mujoco: opendilab/ding:nightly-mujoco
  • dmc: opendilab/ding:nightly-dmc2gym
  • metaworld: opendilab/ding:nightly-metaworld
  • smac: opendilab/ding:nightly-smac
  • grf: opendilab/ding:nightly-grf
  • cityflow: opendilab/ding:nightly-cityflow
  • evogym: opendilab/ding:nightly-evogym
  • d4rl: opendilab/ding:nightly-d4rl

The detailed documentation are hosted on doc | 中文文档.

Quick Start

3 Minutes Kickoff

3 Minutes Kickoff (colab)

DI-engine Huggingface Kickoff (colab)

How to migrate a new RL Env | 如何迁移一个新的强化学习环境

How to customize the neural network model | 如何定制策略使用的神经网络模型

测试/部署 强化学习策略 的样例

[新老 pipeline 的异同对比](https://di-engine-do

Core symbols most depended-on inside this repo

append
called by 611
ding/utils/autolog/data.py
use
called by 597
ding/framework/task.py
mean
called by 511
ding/utils/data/dataset.py
join
called by 330
ding/interaction/master/task.py
forward
called by 300
ding/policy/ppof.py
serial_pipeline
called by 280
ding/entry/serial_entry.py
model_wrap
called by 267
ding/model/wrapper/model_wrappers.py
to_device
called by 266
ding/torch_utils/data_helper.py

Shape

Method 5,345
Function 1,584
Class 1,161
Route 13

Languages

Python100%

Modules by API surface

ding/envs/env_wrappers/env_wrappers.py97 symbols
dizoo/gfootball/model/bots/TamakEriFever/football_ikki.py82 symbols
ding/policy/command_mode_policy_instance.py76 symbols
ding/utils/data/dataset.py71 symbols
ding/model/wrapper/model_wrappers.py69 symbols
ding/torch_utils/network/dreamer.py62 symbols
dizoo/smac/envs/smac_env.py57 symbols
ding/interaction/master/connection.py57 symbols
ding/utils/loader/norm.py49 symbols
dizoo/gfootball/model/bots/rule_based_bot_model.py48 symbols
ding/model/common/head.py48 symbols
ding/interaction/master/master.py48 symbols

For agents

$ claude mcp add DI-engine \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact