Skip to content

Commit e9b5b12

Browse files
authored
Fixes parsing if rnd and symmetry configs not available #72
1 parent 1e49fd0 commit e9b5b12

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ Please keep the lists sorted alphabetically.
3232
* Lorenzo Terenzi
3333
* Marko Bjelonic
3434
* Matthijs van der Boon
35+
* Pascal Roth
3536
* Zhang Chong
3637
* Ziqi Fan

rsl_rl/runners/on_policy_runner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self, env: VecEnv, train_cfg: dict, log_dir: str | None = None, dev
4141
).to(self.device)
4242

4343
# resolve dimension of rnd gated state
44-
if "rnd_cfg" in self.alg_cfg:
44+
if "rnd_cfg" in self.alg_cfg and self.alg_cfg["rnd_cfg"] is not None:
4545
# check if rnd gated state is present
4646
rnd_state = extras["observations"].get("rnd_state")
4747
if rnd_state is None:
@@ -54,7 +54,7 @@ def __init__(self, env: VecEnv, train_cfg: dict, log_dir: str | None = None, dev
5454
self.alg_cfg["rnd_cfg"]["weight"] *= env.dt
5555

5656
# if using symmetry then pass the environment config object
57-
if "symmetry_cfg" in self.alg_cfg:
57+
if "symmetry_cfg" in self.alg_cfg and self.alg_cfg["symmetry_cfg"] is not None:
5858
# this is used by the symmetry function for handling different observation terms
5959
self.alg_cfg["symmetry_cfg"]["_env"] = env
6060

@@ -89,7 +89,7 @@ def __init__(self, env: VecEnv, train_cfg: dict, log_dir: str | None = None, dev
8989
self.current_learning_iteration = 0
9090
self.git_status_repos = [rsl_rl.__file__]
9191

92-
def learn(self, num_learning_iterations: int, init_at_random_ep_len: bool = False):
92+
def learn(self, num_learning_iterations: int, init_at_random_ep_len: bool = False): # noqa: C901
9393
# initialize writer
9494
if self.log_dir is not None and self.writer is None:
9595
# Launch either Tensorboard or Neptune & Tensorboard summary writer(s), default: Tensorboard.

0 commit comments

Comments
 (0)