ver Dec22ndv4
recorded action history
This commit is contained in:
@@ -91,10 +91,12 @@ class DesktopEnv(gym.Env):
|
|||||||
self.result_getter: Getter = getattr(getters, "get_{:}".format(self.evaluator["result"]["type"]))
|
self.result_getter: Getter = getattr(getters, "get_{:}".format(self.evaluator["result"]["type"]))
|
||||||
self.expected_getter: Getter = getattr(getters, "get_{:}".format(self.evaluator["expected"]["type"]))
|
self.expected_getter: Getter = getattr(getters, "get_{:}".format(self.evaluator["expected"]["type"]))
|
||||||
|
|
||||||
# episodic stuffs, like tmp dir and counters
|
# episodic stuffs, like tmp dir and counters, will be updated or reset
|
||||||
|
# when calling self.reset()
|
||||||
self.tmp_dir: str = self.tmp_dir_base # just an init value, updated during reset
|
self.tmp_dir: str = self.tmp_dir_base # just an init value, updated during reset
|
||||||
self._traj_no: int = -1
|
self._traj_no: int = -1
|
||||||
self._step_no: int = 0
|
self._step_no: int = 0
|
||||||
|
self.action_history: List[Dict[str, any]] = []
|
||||||
|
|
||||||
def _start_emulator(self):
|
def _start_emulator(self):
|
||||||
while True:
|
while True:
|
||||||
@@ -166,6 +168,7 @@ class DesktopEnv(gym.Env):
|
|||||||
print("Setting counters...")
|
print("Setting counters...")
|
||||||
self._traj_no += 1
|
self._traj_no += 1
|
||||||
self._step_no = 0
|
self._step_no = 0
|
||||||
|
self.action_history.clear()
|
||||||
|
|
||||||
print("Setup new temp dir...")
|
print("Setup new temp dir...")
|
||||||
self.tmp_dir = tempfile.mkdtemp( prefix="{:d}.{:}.".format(self._traj_no, self.task_id)
|
self.tmp_dir = tempfile.mkdtemp( prefix="{:d}.{:}.".format(self._traj_no, self.task_id)
|
||||||
@@ -200,6 +203,7 @@ class DesktopEnv(gym.Env):
|
|||||||
elif self.action_space == "pyautogui":
|
elif self.action_space == "pyautogui":
|
||||||
# the set of all possible python commands insides `pyautogui`
|
# the set of all possible python commands insides `pyautogui`
|
||||||
self.controller.execute_python_command(action)
|
self.controller.execute_python_command(action)
|
||||||
|
self.action_history.append(action)
|
||||||
|
|
||||||
# todo: maybe for the better here we need to add a logic to wait until the rendering is done
|
# todo: maybe for the better here we need to add a logic to wait until the rendering is done
|
||||||
time.sleep(pause)
|
time.sleep(pause)
|
||||||
|
|||||||
Reference in New Issue
Block a user