parent
d5d521b329
commit
7f8fa241dd
2
.github/workflows/extra_sys.yml
vendored
2
.github/workflows/extra_sys.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest]
|
||||
python-version: [3.7, 3.8]
|
||||
python-version: [3.8, 3.9]
|
||||
steps:
|
||||
- name: Cancel previous run
|
||||
uses: styfle/cancel-workflow-action@0.11.0
|
||||
|
4
.github/workflows/gputest.yml
vendored
4
.github/workflows/gputest.yml
vendored
@ -12,10 +12,10 @@ jobs:
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python 3.8
|
||||
- name: Set up Python 3.10
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.8
|
||||
python-version: "3.10"
|
||||
- name: Upgrade pip
|
||||
run: |
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
|
2
.github/workflows/pytest.yml
vendored
2
.github/workflows/pytest.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.7, 3.8, 3.9]
|
||||
python-version: ["3.8", "3.9", "3.10"]
|
||||
steps:
|
||||
- name: Cancel previous run
|
||||
uses: styfle/cancel-workflow-action@0.11.0
|
||||
|
2
setup.py
2
setup.py
@ -23,6 +23,7 @@ def get_install_requires() -> str:
|
||||
"numba>=0.51.0",
|
||||
"h5py>=2.10.0", # to match tensorflow's minimal requirements
|
||||
"packaging",
|
||||
"pettingzoo>=1.22",
|
||||
]
|
||||
|
||||
|
||||
@ -47,7 +48,6 @@ def get_extras_require() -> str:
|
||||
"doc8",
|
||||
"scipy",
|
||||
"pillow",
|
||||
"pettingzoo>=1.22",
|
||||
"pygame>=2.1.0", # pettingzoo test cases pistonball
|
||||
"pymunk>=6.2.1", # pettingzoo test cases pistonball
|
||||
"nni>=2.3,<3.0", # expect breaking changes at next major version
|
||||
|
@ -1,6 +1,6 @@
|
||||
from tianshou import data, env, exploration, policy, trainer, utils
|
||||
|
||||
__version__ = "0.5.0"
|
||||
__version__ = "0.5.1"
|
||||
|
||||
__all__ = [
|
||||
"env",
|
||||
|
6
tianshou/env/__init__.py
vendored
6
tianshou/env/__init__.py
vendored
@ -5,6 +5,7 @@ from tianshou.env.gym_wrappers import (
|
||||
MultiDiscreteToDiscrete,
|
||||
TruncatedAsTerminated,
|
||||
)
|
||||
from tianshou.env.pettingzoo_env import PettingZooEnv
|
||||
from tianshou.env.venv_wrappers import VectorEnvNormObs, VectorEnvWrapper
|
||||
from tianshou.env.venvs import (
|
||||
BaseVectorEnv,
|
||||
@ -14,11 +15,6 @@ from tianshou.env.venvs import (
|
||||
SubprocVectorEnv,
|
||||
)
|
||||
|
||||
try:
|
||||
from tianshou.env.pettingzoo_env import PettingZooEnv
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
__all__ = [
|
||||
"BaseVectorEnv",
|
||||
"DummyVectorEnv",
|
||||
|
4
tianshou/env/gym_wrappers.py
vendored
4
tianshou/env/gym_wrappers.py
vendored
@ -26,7 +26,7 @@ class ContinuousToDiscrete(gym.ActionWrapper):
|
||||
dtype=object
|
||||
)
|
||||
|
||||
def action(self, act: np.ndarray) -> np.ndarray: # type: ignore
|
||||
def action(self, act: np.ndarray) -> np.ndarray:
|
||||
# modify act
|
||||
assert len(act.shape) <= 2, f"Unknown action format with shape {act.shape}."
|
||||
if len(act.shape) == 1:
|
||||
@ -50,7 +50,7 @@ class MultiDiscreteToDiscrete(gym.ActionWrapper):
|
||||
self.bases[i] = self.bases[i - 1] * nvec[-i]
|
||||
self.action_space = gym.spaces.Discrete(np.prod(nvec))
|
||||
|
||||
def action(self, act: np.ndarray) -> np.ndarray: # type: ignore
|
||||
def action(self, act: np.ndarray) -> np.ndarray:
|
||||
converted_act = []
|
||||
for b in np.flip(self.bases):
|
||||
converted_act.append(act // b)
|
||||
|
5
tianshou/env/utils.py
vendored
5
tianshou/env/utils.py
vendored
@ -4,10 +4,7 @@ import cloudpickle
|
||||
import gymnasium
|
||||
import numpy as np
|
||||
|
||||
try:
|
||||
from tianshou.env.pettingzoo_env import PettingZooEnv
|
||||
except ImportError:
|
||||
PettingZooEnv = None # type: ignore
|
||||
from tianshou.env.pettingzoo_env import PettingZooEnv
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import gym
|
||||
|
6
tianshou/env/venvs.py
vendored
6
tianshou/env/venvs.py
vendored
@ -5,6 +5,7 @@ import gymnasium as gym
|
||||
import numpy as np
|
||||
import packaging
|
||||
|
||||
from tianshou.env.pettingzoo_env import PettingZooEnv
|
||||
from tianshou.env.utils import ENV_TYPE, gym_new_venv_step_type
|
||||
from tianshou.env.worker import (
|
||||
DummyEnvWorker,
|
||||
@ -13,11 +14,6 @@ from tianshou.env.worker import (
|
||||
SubprocEnvWorker,
|
||||
)
|
||||
|
||||
try:
|
||||
from tianshou.env.pettingzoo_env import PettingZooEnv
|
||||
except ImportError:
|
||||
PettingZooEnv = None # type: ignore
|
||||
|
||||
try:
|
||||
import gym as old_gym
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user