added the option for a deterministic run
This commit is contained in:
@@ -5,7 +5,7 @@ import numpy as np
|
||||
class Crafter:
|
||||
metadata = {}
|
||||
|
||||
def __init__(self, task, size=(64, 64), seed=None):
|
||||
def __init__(self, task, size=(64, 64), seed=0):
|
||||
assert task in ("reward", "noreward")
|
||||
import crafter
|
||||
|
||||
|
||||
@@ -5,14 +5,18 @@ import numpy as np
|
||||
class DeepMindControl:
|
||||
metadata = {}
|
||||
|
||||
def __init__(self, name, action_repeat=1, size=(64, 64), camera=None):
|
||||
def __init__(self, name, action_repeat=1, size=(64, 64), camera=None, seed=0):
|
||||
domain, task = name.split("_", 1)
|
||||
if domain == "cup": # Only domain with multiple words.
|
||||
domain = "ball_in_cup"
|
||||
if isinstance(domain, str):
|
||||
from dm_control import suite
|
||||
|
||||
self._env = suite.load(domain, task)
|
||||
self._env = suite.load(
|
||||
domain,
|
||||
task,
|
||||
task_kwargs={"random": seed},
|
||||
)
|
||||
else:
|
||||
assert task is None
|
||||
self._env = domain()
|
||||
|
||||
@@ -5,11 +5,11 @@ import numpy as np
|
||||
|
||||
|
||||
class MemoryMaze:
|
||||
def __init__(self, task, obs_key="image", act_key="action", size=(64, 64)):
|
||||
def __init__(self, task, obs_key="image", act_key="action", size=(64, 64), seed=0):
|
||||
if task == "9x9":
|
||||
self._env = gym.make("memory_maze:MemoryMaze-9x9-v0")
|
||||
self._env = gym.make("memory_maze:MemoryMaze-9x9-v0", seed=seed)
|
||||
elif task == "15x15":
|
||||
self._env = gym.make("memory_maze:MemoryMaze-15x15-v0")
|
||||
self._env = gym.make("memory_maze:MemoryMaze-15x15-v0", seed=seed)
|
||||
else:
|
||||
raise NotImplementedError(task)
|
||||
self._obs_is_dict = hasattr(self._env.observation_space, "spaces")
|
||||
|
||||
Reference in New Issue
Block a user