2727import numpy as np
2828
2929from tensorforce .config import Config
30- from tensorforce .external .openai_universe import OpenAIUniverseEnvironment
31- from tensorforce .util .agent_util import create_agent , get_default_config
32- from tensorforce .util .wrapper_util import create_wrapper
30+ from tensorforce .environments .openai_universe import OpenAIUniverse
31+ from tensorforce .util import create_agent , get_default_config , build_preprocessing_stack
3332
3433
3534def main ():
@@ -55,7 +54,7 @@ def main():
5554
5655 max_timesteps = args .max_timesteps
5756
58- environment = OpenAIUniverseEnvironment (env_id )
57+ environment = OpenAIUniverse (env_id )
5958
6059 config = Config ({
6160 'actions' : environment .actions ,
@@ -69,10 +68,13 @@ def main():
6968 if args .network_config :
7069 config .read_json (args .network_config )
7170
72- state_wrapper = None
73- if config .state_wrapper :
74- state_wrapper = create_wrapper (config .state_wrapper , config .state_wrapper_param )
75- config .state_shape = state_wrapper .state_shape (config .state_shape )
71+
72+ preprocessing_config = config .get ('preprocessing' )
73+ if preprocessing_config :
74+ stack = build_preprocessing_stack (preprocessing_config )
75+ config .state_shape = stack .shape (config .state_shape )
76+ else :
77+ stack = None
7678
7779 agent = create_agent (args .agent , config )
7880
@@ -89,8 +91,8 @@ def main():
8991 episode_reward = 0
9092 repeat_action_count = 0
9193 for j in xrange (max_timesteps ):
92- if state_wrapper :
93- full_state = state_wrapper . get_full_state (state )
94+ if stack :
95+ full_state = stack . process (state )
9496 else :
9597 full_state = state
9698 if repeat_action_count <= 0 :
0 commit comments