File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change 16
16
17
17
import dataclasses
18
18
from typing import Any , Callable , Optional
19
-
20
- from android_env import env_interface
21
19
from android_world import constants
22
20
from android_world .agents import base_agent
21
+ from android_world .env import interface
23
22
import termcolor
24
23
25
24
@@ -45,9 +44,7 @@ def run_episode(
45
44
agent : base_agent .EnvironmentInteractingAgent ,
46
45
max_n_steps : int = 10 ,
47
46
start_on_home_screen : bool = False ,
48
- termination_fn : (
49
- Callable [[env_interface .AndroidEnvInterface ], float ] | None
50
- ) = None ,
47
+ termination_fn : Callable [[interface .AsyncEnv ], float ] | None = None ,
51
48
) -> EpisodeResult :
52
49
"""Runs an agent on goal, e.g., "turn off wifi".
53
50
@@ -83,7 +80,7 @@ def run_episode(
83
80
print ('Completed step {:d}.' .format (step_n + 1 ))
84
81
assert constants .STEP_NUMBER not in result .data
85
82
output .append (result .data | {constants .STEP_NUMBER : step_n })
86
- if termination_fn (agent .env . controller ):
83
+ if termination_fn (agent .env ):
87
84
print ('Environment ends episode.' )
88
85
return EpisodeResult (
89
86
done = True ,
Original file line number Diff line number Diff line change @@ -59,9 +59,9 @@ def get_episode_reward(env: env_interface.AndroidEnvInterface) -> float:
59
59
return float (int (reward ))
60
60
61
61
62
- def is_episode_terminated (env : env_interface . AndroidEnvInterface ) -> bool :
62
+ def is_episode_terminated (env : interface . AsyncEnv ) -> bool :
63
63
"""Checks if the current episode is terminated."""
64
- return get_episode_reward (env ) != 0.0
64
+ return get_episode_reward (env . controller . env ) != 0.0
65
65
66
66
67
67
class MiniWoBTask (task_eval .TaskEval , abc .ABC ):
You can’t perform that action at this time.
0 commit comments