← 开源
sotetsuk

pgx

♟️ Vectorized RL game environments in JAX

Model DevelopmentEnvironmentsPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
653
Star
56
Fork
+1
本周
17
贡献者
创建于 2022-08-11 · 更新于 2026-10-10 · 今日第 15458 名
主要开发者

sotetsuk/pgx 排名第 15,458,有 653 个星标。

同类别比较

sotetsuk/pgx 排名第 15,458,此处有 8 个同类条目;leaderj1001/Attention-Augmented-Conv2d 排名第 15,457。

同类别比较
名称排名指标
Yuliang-Liu/Curve-Text-Detector15,449
语言:
Jupyter Notebook
星标数:
653
分叉数:
156
简介:
This repository provides train&test code, dataset, det.&rec. annotation, evaluation script, annotation tool, and ranking.
ascust/3DMM-Fitting-Pytorch15,450
语言:
Python
星标数:
653
分叉数:
97
简介:
A 3DMM fitting framework using Pytorch.
choosewhatulike/trainable-agents15,452
语言:
Python
星标数:
653
分叉数:
51
简介:
Code and datasets for "Character-LLM: A Trainable Agent for Role-Playing"
leaderj1001/Attention-Augmented-Conv2d15,457
语言:
Python
星标数:
653
分叉数:
101
简介:
Implementing Attention Augmented Convolutional Networks using Pytorch
uxlfoundation/oneDAL15,460
语言:
C++
星标数:
653
分叉数:
228
简介:
oneAPI Data Analytics Library (oneDAL)
BMW-InnovationLab/BMW-YOLOv4-Training-Automation15,462
语言:
Python
星标数:
652
分叉数:
125
简介:
This repository allows you to get started with training a state-of-the-art Deep Learning model with little to no configuration needed! You provide your labeled dataset or label your dataset using our BMW-LabelTool-Lite and you can start the training right away and monitor it in many different ways like TensorBoard or a custom REST API and GUI. NoCode training with YOLOv4 and YOLOV3 has never been so easy.
ChenHongruixuan/ChangeMamba15,464
语言:
Python
星标数:
652
分叉数:
48
简介:
[IEEE TGRS 2024] ChangeMamba: Remote Sensing Change Detection Based on Spatio-Temporal State Space Model
JuliaReinforcementLearning/ReinforcementLearning.jl15,466
语言:
Julia
星标数:
652
分叉数:
108
简介:
A reinforcement learning package for Julia
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Environments
关键词Gaming, RL
星标数653
分叉数56
贡献者17
创建日期2022-08-11
更新日期2026-10-10
1 天星标数0
7 天星标数1
排名15,458
上次排名15,267
排名变化-191
7 天星标排名11,027
上次 7 天星标排名11,097
7 天星标排名变化70
总星标排名15,701
上次总星标排名15,668
总星标排名变化-33
国家Japan
README 摘录

A collection of GPU-accelerated parallel game simulators for reinforcement learning (RL) [! NOTE] >⭐ If you find this project helpful, we would be grateful for your support through a GitHub star to help us grow the community and motivate further development! Brax, a JAX-native physics engine, provides extremely high-speed parallel simulation for RL in *continuous* state space. Then, what about RL in *discrete* state spaces like Chess, Shogi, and Go? **Pgx** provides a wide variety of JAX-native game

simulators! Highlighted features include: ⚡ **Super fast** in parallel execution on accelerators 🎲 **Various game support** including **Backgammon**, **Chess**, **Shogi**, and **Go** 🖼️ **Beautiful visualization** in SVG format Quick start Getting started Pgx baseline models Export to PettingZoo API Read the Full Documentation for more details Training examples AlphaZero PPO Usage Pgx is available on PyPI. Note that your Python environment has and installed, depending on your hardware specification. The following code snippet shows a simple example of using Pgx. Note that all

functions in Pgx environments are **JAX-native. Please refer to the documentation for more details. Pgx is a library that focuses on faster implementations rather than just the API itself. However, the API itself is also sufficiently general. For example, all environments in Pgx can be converted to the AEC API of PettingZoo, and you can run Pgx environments through the PettingZoo API. You can see the demonstration in this Colab. 0) Pgx has been updated from API **v1** to

**v2** as of November 8, 2023 (release ** **). As a result, the signature for has changed as follows: **v1**: **v2**: Also, are changed to specify as the third argument. **Purpose of the update:** In API v1, even in environments with stochastic state transitions, the state transitions were deterministic, determined by the inside the . This was intentional, with the aim of increasing reproducibility. However, when using planning algorithms in this environment, there is a risk that information about the underlying true randomness

could "leak. " To make it easier for users to conduct correct experiments, has been changed to explicitly specify a key. **Impact of the update**: Since the is optional, it is still possible to execute as like API v1 in deterministic environments like Go and chess, so there is no impact on these games. As of , **only 2048, backgammon, and MinAtar suite are affected by this change. * | | Animal Shogi | | | *Animal-themed child-friendly shogi. * | | Backgammon | | | *Luck aids bearing off checkers. * | | Bridge

bidding | | | *Partners exchange information via bids. * | | Chess | | | *Checkmate opponent's king to win. * | | Connect Four | | | *Connect discs, win with four. * | | Gardner Chess | | | *5x5 chess variant, excluding castling. * | | Go | | | *Strategically place stones, claim territory. * | | Hex | | | *Connect opposite sides, block opponent. * | | Kuhn Poker | | | *Three-card betting and bluffing game. * | | Leduc hold'em | | | *Two-suit, limited deck poker. * | | MinAtar/Asterix | | | *Avoid enemies, collect treasure, survive. * | | MinAtar/Breakout | | | *Paddle, ball, bricks, bounce, clear. * | | MinAtar/Freeway | | | *Dodging cars, climbing up freeway. * | | MinAtar/Seaquest | | | *Underwater submarine rescue and

combat. * | | MinAtar/SpaceInvaders | | | *Alien shooter game, dodge bullets. * | | Othello | | | *Flip and conquer opponent's pieces. * | | Shogi | | | *Japanese chess with captured pieces.

常见问题

记录了多少星标和分叉?

sotetsuk/pgx 有 653 个星标和 56 个分叉。

仓库排名是多少?

sotetsuk/pgx 排名第 15,458。

记录的语言和类别是什么?

sotetsuk/pgx 有 653 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

sotetsuk/pgx 与 leaderj1001/Attention-Augmented-Conv2d 比较,后者排名第 15,457,有 653 个星标。

README

A collection of GPU-accelerated parallel game simulators for reinforcement learning (RL)

[!NOTE] ⭐ If you find this project helpful, we would be grateful for your support through a GitHub star to help us grow the community and motivate further development!

Why Pgx?

Brax, a JAX-native physics engine, provides extremely high-speed parallel simulation for RL in continuous state space. Then, what about RL in discrete state spaces like Chess, Shogi, and Go? Pgx provides a wide variety of JAX-native game simulators! Highlighted features include:

  • ⚡ Super fast in parallel execution on accelerators
  • 🎲 Various game support including Backgammon, Chess, Shogi, and Go
  • 🖼️ Beautiful visualization in SVG format

Quick start

Read the Full Documentation for more details

Training examples

Usage

Pgx is available on PyPI. Note that your Python environment has jax and jaxlib installed, depending on your hardware specification.

$ pip install pgx

The following code snippet shows a simple example of using Pgx. You can try it out in this Colab. Note that all step functions in Pgx environments are JAX-native., i.e., they are all JIT-able. Please refer to the documentation for more details.

import jax
import pgx

env = pgx.make("go_19x19")
init = jax.jit(jax.vmap(env.init))
step = jax.jit(jax.vmap(env.step))

batch_size = 1024
keys = jax.random.split(jax.random.PRNGKey(42), batch_size)
state = init(keys)  # vectorized states
while not (state.terminated | state.truncated).all():
    action = model(state.current_player, state.observation, state.legal_action_mask)
    # step(state, action, keys) for stochastic envs
    state = step(state, action)  # state.rewards with shape (1024, 2)

Pgx is a library that focuses on faster implementations rather than just the API itself. However, the API itself is also sufficiently general. For example, all environments in Pgx can be converted to the AEC API of PettingZoo, and you can run Pgx environments through the PettingZoo API. You can see the demonstration in this Colab.

📣 API v2 (v2.0.0)

Pgx has been updated from API v1 to v2 as of November 8, 2023 (release v2.0.0). As a result, the signature for Env.step has changed as follows:

  • v1: step(state: State, action: Array)
  • v2: step(state: State, action: Array, key: Optional[PRNGKey] = None)

Also, pgx.experimental.auto_reset are changed to specify key as the third argument.

Purpose of the update: In API v1, even in environments with stochastic state transitions, the state transitions were deterministic, determined by the _rng_key inside the state. This was intentional, with the aim of increasing reproducibility. However, when using planning algorithms in this environment, there is a risk that information about the underlying true randomness could "leak." To make it easier for users to conduct correct experiments, Env.step has been changed to explicitly specify a key.

Impact of the update: Since the key is optional, it is still possible to execute as env.step(state, action) like API v1 in deterministic environments like Go and chess, so there is no impact on these games. As of v2.0.0, only 2048, backgammon, and MinAtar suite are affected by this change.

Supported games

Backgammon Chess Shogi Go

Use pgx.available_envs() -> Tuple[EnvId] to see the list of currently available games. Given an ``, you can create the environment via

>>> env = pgx.make()
Game/EnvId Visualization Version Five-word description by ChatGPT
2048
"2048" v2 Merge tiles to create 2048.
Animal Shogi
"animal_shogi" v2 Animal-themed child-friendly shogi.
Backgammon
"backgammon" v2 Luck aids bearing off checkers.
Bridge bidding
"bridge_bidding" v1 Partners exchange information via bids.
Chess
"chess" v2 Checkmate opponent's king to win.
Connect Four
"connect_four" v0 Connect discs, win with four.
Gardner Chess
"gardner_chess" v0 5x5 chess variant, excluding castling.
Go
"go_9x9" "go_19x19" v1 Strategically place stones, claim territory.
Hex
"hex" v0 Connect opposite sides, block opponent.
Kuhn Poker
"kuhn_poker" v1 Three-card betting and bluffing game.
Leduc hold'em
"leduc_holdem" v0 Two-suit, limited deck poker.
MinAtar/Asterix
"minatar-asterix" v1 Avoid enemies, collect treasure, survive.
MinAtar/Breakout
"minatar-breakout" v1 Paddle, ball, bricks, bounce, clear.
MinAtar/Freeway
"minatar-freeway" v1 Dodging cars, climbing up freeway.
MinAtar/Seaquest
"minatar-seaquest" v1 Underwater submarine rescue and combat.
MinAtar/SpaceInvaders
"minatar-space_invaders" v1 Alien shooter game, dodge bullets.
Othello
"othello" v0 Flip and conquer opponent's pieces.
Shogi
"shogi" v1 Japanese chess with captured pieces.
Sparrow Mahjong
"sparrow_mahjong" v1 A simplified, children-friendly Mahjong.
Tic-tac-toe
"tic_tac_toe" v0 Three in a row wins.

Versioning policy

Each environment is versioned, and the version is incremented when there are changes that affect the performance of agents or when there are changes that are not backward compatible with the API. If you want to pursue complete reproducibility, we recommend that you check the version of Pgx and each environment as follows:

>>> pgx.__version__
'1.0.0'
>>> env.version
'v0'

See also

Pgx is intended to complement these JAX-native environments with (classic) board game suits:

Combining Pgx with these JAX-native algorithms/implementations might be an interesting direction:

Limitation

Currently, some environments, including Go and chess, do not perform well on TPUs. Please use GPUs instead.

Citation

If you use Pgx in your work, please cite our paper:

@inproceedings{koyamada2023pgx,
  title={Pgx: Hardware-Accelerated Parallel Game Simulators for Reinforcement Learning},
  author={Koyamada, Sotetsu and Okano, Shinri and Nishimori, Soichiro and Murata, Yu and Habara, Keigo and Kita, Haruka and Ishii, Shin},
  booktitle={Advances in Neural Information Processing Systems},
  pages={45716--45743},
  volume={36},
  year={2023}
}

LICENSE

Apache-2.0

排名相邻
同类项目