Skip to content

Commit 32ffd75

Browse files
black formatted and made toy and complex env reward delay consistent
1 parent 0fc373c commit 32ffd75

File tree

192 files changed

+968
-658
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+968
-658
lines changed

example.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def display_image(obs, mode="RGB"):
3434
# to be 3-D.
3535
img1.show()
3636

37+
3738
def discrete_environment_example():
3839

3940
config = {}
@@ -245,7 +246,6 @@ def grid_environment_image_representations_example():
245246
display_image(next_obs)
246247

247248

248-
249249
def atari_wrapper_example():
250250

251251
config = {
@@ -304,6 +304,7 @@ def mujoco_wrapper_example():
304304
try:
305305
from mdp_playground.envs import get_mujoco_wrapper
306306
from gym.envs.mujoco.half_cheetah_v3 import HalfCheetahEnv
307+
307308
wrapped_mujoco_env = get_mujoco_wrapper(HalfCheetahEnv)
308309

309310
env = wrapped_mujoco_env(**config)
@@ -319,7 +320,12 @@ def mujoco_wrapper_example():
319320
env.close()
320321

321322
except ImportError as e:
322-
print("Exception:", type(e), e, "caught. You may need to install mujoco-py. NOT running mujoco_wrapper_example.")
323+
print(
324+
"Exception:",
325+
type(e),
326+
e,
327+
"caught. You may need to install mujoco-py. NOT running mujoco_wrapper_example.",
328+
)
323329
return
324330

325331

@@ -337,12 +343,13 @@ def minigrid_wrapper_example():
337343
import gym
338344

339345
from gym_minigrid.wrappers import RGBImgPartialObsWrapper, ImgObsWrapper
340-
env = gym.make('MiniGrid-Empty-8x8-v0')
341-
env = RGBImgPartialObsWrapper(env) # Get pixel observations
342-
env = ImgObsWrapper(env) # Get rid of the 'mission' field
346+
347+
env = gym.make("MiniGrid-Empty-8x8-v0")
348+
env = RGBImgPartialObsWrapper(env) # Get pixel observations
349+
env = ImgObsWrapper(env) # Get rid of the 'mission' field
343350

344351
env = GymEnvWrapper(env, **config)
345-
obs = env.reset() # This now produces an RGB tensor only
352+
obs = env.reset() # This now produces an RGB tensor only
346353

347354
print(
348355
"Taking a step in the environment with a random action and printing the transition:"

experiments/a3c_beam_rider_del.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 5
56
timesteps_total = 10_000_000
67

@@ -103,8 +104,8 @@
103104
value_tuples = []
104105
for config_type, config_dict in var_configs.items():
105106
for key in config_dict:
106-
assert (
107-
isinstance(var_configs[config_type][key], list)
107+
assert isinstance(
108+
var_configs[config_type][key], list
108109
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
109110
value_tuples.append(var_configs[config_type][key])
110111

experiments/a3c_beam_rider_image_transforms_42.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 5
56
timesteps_total = 10_000_000
67

experiments/a3c_beam_rider_image_transforms_42_sh_quant.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 5
56
timesteps_total = 10_000_000
67

experiments/a3c_beam_rider_p_noise.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 5
56
timesteps_total = 10_000_000
67

@@ -103,8 +104,8 @@
103104
value_tuples = []
104105
for config_type, config_dict in var_configs.items():
105106
for key in config_dict:
106-
assert (
107-
isinstance(var_configs[config_type][key], list)
107+
assert isinstance(
108+
var_configs[config_type][key], list
108109
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
109110
value_tuples.append(var_configs[config_type][key])
110111

experiments/a3c_beam_rider_r_noise.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from ray import tune
33
import numpy as np
44
from collections import OrderedDict
5+
56
num_seeds = 5
67
timesteps_total = 10_000_000
78

@@ -106,8 +107,8 @@
106107
value_tuples = []
107108
for config_type, config_dict in var_configs.items():
108109
for key in config_dict:
109-
assert (
110-
isinstance(var_configs[config_type][key], list)
110+
assert isinstance(
111+
var_configs[config_type][key], list
111112
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
112113
value_tuples.append(var_configs[config_type][key])
113114

experiments/a3c_breakout_del.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 5
56
timesteps_total = 10_000_000
67

@@ -103,8 +104,8 @@
103104
value_tuples = []
104105
for config_type, config_dict in var_configs.items():
105106
for key in config_dict:
106-
assert (
107-
isinstance(var_configs[config_type][key], list)
107+
assert isinstance(
108+
var_configs[config_type][key], list
108109
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
109110
value_tuples.append(var_configs[config_type][key])
110111

experiments/a3c_breakout_image_transforms_42.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 5
56
timesteps_total = 10_000_000
67

experiments/a3c_breakout_image_transforms_42_sh_quant.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 5
56
timesteps_total = 10_000_000
67

experiments/a3c_breakout_p_noise.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 5
56
timesteps_total = 10_000_000
67

@@ -103,8 +104,8 @@
103104
value_tuples = []
104105
for config_type, config_dict in var_configs.items():
105106
for key in config_dict:
106-
assert (
107-
isinstance(var_configs[config_type][key], list)
107+
assert isinstance(
108+
var_configs[config_type][key], list
108109
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
109110
value_tuples.append(var_configs[config_type][key])
110111

experiments/a3c_breakout_r_noise.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from ray import tune
33
import numpy as np
44
from collections import OrderedDict
5+
56
num_seeds = 5
67
timesteps_total = 10_000_000
78

@@ -106,8 +107,8 @@
106107
value_tuples = []
107108
for config_type, config_dict in var_configs.items():
108109
for key in config_dict:
109-
assert (
110-
isinstance(var_configs[config_type][key], list)
110+
assert isinstance(
111+
var_configs[config_type][key], list
111112
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
112113
value_tuples.append(var_configs[config_type][key])
113114

experiments/a3c_breakout_tune_hps.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 3
56

67
var_env_configs = OrderedDict(
@@ -118,8 +119,8 @@
118119
value_tuples = []
119120
for config_type, config_dict in var_configs.items():
120121
for key in config_dict:
121-
assert (
122-
isinstance(var_configs[config_type][key], list)
122+
assert isinstance(
123+
var_configs[config_type][key], list
123124
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
124125
value_tuples.append(var_configs[config_type][key])
125126

experiments/a3c_image_representations.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from ray import tune
44
from collections import OrderedDict
55
import itertools
6+
67
num_seeds = 10
78

89

@@ -184,8 +185,8 @@
184185
value_tuples = []
185186
for config_type, config_dict in var_configs.items():
186187
for key in config_dict:
187-
assert (
188-
isinstance(var_configs[config_type][key], list)
188+
assert isinstance(
189+
var_configs[config_type][key], list
189190
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
190191
value_tuples.append(var_configs[config_type][key])
191192

experiments/a3c_image_representations_tune_hps.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import itertools
44
from ray import tune
55
from collections import OrderedDict
6+
67
num_seeds = 3
78

89

@@ -183,8 +184,8 @@
183184
value_tuples = []
184185
for config_type, config_dict in var_configs.items():
185186
for key in config_dict:
186-
assert (
187-
isinstance(var_configs[config_type][key], list)
187+
assert isinstance(
188+
var_configs[config_type][key], list
188189
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
189190
value_tuples.append(var_configs[config_type][key])
190191

experiments/a3c_lstm_image_representations.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from ray import tune
44
from collections import OrderedDict
55
import itertools
6+
67
num_seeds = 10
78

89

@@ -184,8 +185,8 @@
184185
value_tuples = []
185186
for config_type, config_dict in var_configs.items():
186187
for key in config_dict:
187-
assert (
188-
isinstance(var_configs[config_type][key], list)
188+
assert isinstance(
189+
var_configs[config_type][key], list
189190
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
190191
value_tuples.append(var_configs[config_type][key])
191192

experiments/a3c_lstm_image_representations_tune_hps.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import itertools
44
from ray import tune
55
from collections import OrderedDict
6+
67
num_seeds = 3
78

89

@@ -183,8 +184,8 @@
183184
value_tuples = []
184185
for config_type, config_dict in var_configs.items():
185186
for key in config_dict:
186-
assert (
187-
isinstance(var_configs[config_type][key], list)
187+
assert isinstance(
188+
var_configs[config_type][key], list
188189
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
189190
value_tuples.append(var_configs[config_type][key])
190191

experiments/a3c_lstm_make_denser.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 10
56

67
var_env_configs = OrderedDict(
@@ -99,8 +100,8 @@
99100
value_tuples = []
100101
for config_type, config_dict in var_configs.items():
101102
for key in config_dict:
102-
assert (
103-
isinstance(var_configs[config_type][key], list)
103+
assert isinstance(
104+
var_configs[config_type][key], list
104105
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
105106
value_tuples.append(var_configs[config_type][key])
106107

experiments/a3c_lstm_p_r_noises.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 10
56

67
var_env_configs = OrderedDict(
@@ -99,8 +100,8 @@
99100
value_tuples = []
100101
for config_type, config_dict in var_configs.items():
101102
for key in config_dict:
102-
assert (
103-
isinstance(var_configs[config_type][key], list)
103+
assert isinstance(
104+
var_configs[config_type][key], list
104105
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
105106
value_tuples.append(var_configs[config_type][key])
106107

experiments/a3c_lstm_seq_del.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 10
56

67
var_env_configs = OrderedDict(
@@ -99,8 +100,8 @@
99100
value_tuples = []
100101
for config_type, config_dict in var_configs.items():
101102
for key in config_dict:
102-
assert (
103-
isinstance(var_configs[config_type][key], list)
103+
assert isinstance(
104+
var_configs[config_type][key], list
104105
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
105106
value_tuples.append(var_configs[config_type][key])
106107

experiments/a3c_lstm_sparsity.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 10
56

67
var_env_configs = OrderedDict(
@@ -99,8 +100,8 @@
99100
value_tuples = []
100101
for config_type, config_dict in var_configs.items():
101102
for key in config_dict:
102-
assert (
103-
isinstance(var_configs[config_type][key], list)
103+
assert isinstance(
104+
var_configs[config_type][key], list
104105
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
105106
value_tuples.append(var_configs[config_type][key])
106107

experiments/a3c_make_denser.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import itertools
22
from ray import tune
33
from collections import OrderedDict
4+
45
num_seeds = 10
56

67
var_env_configs = OrderedDict(
@@ -100,8 +101,8 @@
100101
value_tuples = []
101102
for config_type, config_dict in var_configs.items():
102103
for key in config_dict:
103-
assert (
104-
isinstance(var_configs[config_type][key], list)
104+
assert isinstance(
105+
var_configs[config_type][key], list
105106
), "var_config should be a dict of dicts with lists as the leaf values to allow each configuration option to take multiple possible values"
106107
value_tuples.append(var_configs[config_type][key])
107108

0 commit comments

Comments
 (0)