Skip to content

Commit

Permalink
remove some deprecated code and pin pytest <8
Browse files Browse the repository at this point in the history
Pytest 8 breaks import order of pytorch and isaacgym, which has to happen a certain due to some singleton issues I don't understand.
  • Loading branch information
sheim committed Feb 26, 2024
1 parent b9039ce commit f221dbe
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 119 deletions.
7 changes: 3 additions & 4 deletions gym/utils/task_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from datetime import datetime
from typing import Tuple

from learning.env import VecEnv
from learning.runners import * # noqa: F403
from learning.utils import set_discount_from_horizon

Expand Down Expand Up @@ -67,15 +66,15 @@ def __init__(self):
def register(
self,
name: str,
task_class: VecEnv,
task_class,
env_cfg: BaseConfig,
train_cfg: LeggedRobotRunnerCfg,
):
self.task_classes[name] = task_class
self.env_cfgs[name] = env_cfg
self.train_cfgs[name] = train_cfg

def get_task_class(self, name: str) -> VecEnv:
def get_task_class(self, name: str):
return self.task_classes[name]

def get_cfgs(self, name) -> Tuple[LeggedRobotCfg, LeggedRobotRunnerCfg]:
Expand Down Expand Up @@ -217,7 +216,7 @@ def make_sim(self):
self.sim["params"],
)

def make_env(self, name, env_cfg) -> VecEnv:
def make_env(self, name, env_cfg):
if name in self.task_classes:
task_class = self.get_task_class(name)
else:
Expand Down
33 changes: 0 additions & 33 deletions learning/env/__init__.py

This file was deleted.

75 changes: 0 additions & 75 deletions learning/env/vec_env.py

This file was deleted.

3 changes: 1 addition & 2 deletions learning/runners/BaseRunner.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import torch
from learning.algorithms import PPO
from learning.modules import ActorCritic
from learning.env import VecEnv
from learning.utils import remove_zero_weighted_rewards


class BaseRunner:
def __init__(self, env: VecEnv, train_cfg, device="cpu"):
def __init__(self, env, train_cfg, device="cpu"):
self.device = device
self.env = env
self.parse_train_cfg(train_cfg)
Expand Down
3 changes: 1 addition & 2 deletions learning/runners/my_runner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import torch
from learning.env import VecEnv

from learning.utils import Logger
from learning.utils import PotentialBasedRewardShaping
Expand All @@ -11,7 +10,7 @@


class MyRunner(OnPolicyRunner):
def __init__(self, env: VecEnv, train_cfg, device="cpu"):
def __init__(self, env, train_cfg, device="cpu"):
super().__init__(env, train_cfg, device)
logger.initialize(
self.env.num_envs,
Expand Down
3 changes: 1 addition & 2 deletions learning/runners/on_policy_runner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import torch
from learning.env import VecEnv

from learning.utils import Logger

Expand All @@ -10,7 +9,7 @@


class OnPolicyRunner(BaseRunner):
def __init__(self, env: VecEnv, train_cfg, device="cpu"):
def __init__(self, env, train_cfg, device="cpu"):
super().__init__(env, train_cfg, device)
logger.initialize(
self.env.num_envs,
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ torch>=2.0
torchvision
torchaudio
pygame
pytest
pytest<8.0
mss
ruff
pre-commit
Expand Down

0 comments on commit f221dbe

Please sign in to comment.