added the option for a deterministic run

This commit is contained in:
NM512
2023-08-16 21:46:06 +09:00
parent 68096d1f62
commit 606ec8af8c
7 changed files with 47 additions and 16 deletions

View File

@@ -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()