def __init__(self): """ Default constructor. """ self._config_handler = KatherineApplication.get_application_config() if not self._config_handler: raise ValueError("No config_handler specified") self._log = logger.get_logger(self.__class__.__name__)
def _load_configuration() -> Collection[Tuple]: """ Loads the server configurations. :return: a list of tuples with server configs """ return KatherineApplication.get_application_config( ).get_config_property(KatConfigurationProperty.CLUSTER_INFO, KatConfigurationProperty.CLUSTER_INFO.prop_type)
def _load_configuration(self): """ Loads necessary configurations. """ self._config_handler = KatherineApplication.get_application_config() if not self._config_handler: raise ValueError("No configuration handler specified.") self._train_batch_size = self._config_handler.get_config_property( KatConfigurationProperty.TRAIN_BATCH_SIZE, KatConfigurationProperty.TRAIN_BATCH_SIZE.prop_type) self._distributed_learning_enabled = self._config_handler.get_config_property( AgentConfigurationProperty.DISTRIBUTED_LEARNING_ENABLED, AgentConfigurationProperty.DISTRIBUTED_LEARNING_ENABLED.prop_type) self._convert_to_monochrome = self._config_handler.get_config_property( AgentConfigurationProperty.CONVERT_TO_MONOCHROME, AgentConfigurationProperty.CONVERT_TO_MONOCHROME.prop_type) self._screen_channels = self._config_handler.get_config_property( AgentConfigurationProperty.SCREEN_CHANNELS, AgentConfigurationProperty.SCREEN_CHANNELS.prop_type) self._frame_stacking_enabled = self._config_handler.get_config_property( AgentConfigurationProperty.FRAME_STACKING_ENABLED, AgentConfigurationProperty.FRAME_STACKING_ENABLED.prop_type) self._number_of_stacked_frames = self._config_handler.get_config_property( AgentConfigurationProperty.NUMBER_OF_STACKED_FRAMES, AgentConfigurationProperty.NUMBER_OF_STACKED_FRAMES.prop_type) self._screen_size = ( self._config_handler.get_config_property( AgentConfigurationProperty.SCREEN_HEIGHT, AgentConfigurationProperty.SCREEN_HEIGHT.prop_type), self._config_handler.get_config_property( AgentConfigurationProperty.SCREEN_WEIGHT, AgentConfigurationProperty.SCREEN_WEIGHT.prop_type)) self._input_observation_name = self._config_handler.get_config_property( AgentConfigurationProperty.INPUT_OBSERVATION_NAME, AgentConfigurationProperty.INPUT_OBSERVATION_NAME.prop_type) self._initial_epsilon = self._config_handler.get_config_property( AgentConfigurationProperty.INITIAL_EXPLORATION_RATE, AgentConfigurationProperty.INITIAL_EXPLORATION_RATE.prop_type) self._final_epsilon = self._config_handler.get_config_property( AgentConfigurationProperty.FINAL_EXPLORATION_RATE, AgentConfigurationProperty.FINAL_EXPLORATION_RATE.prop_type) self._constant_exploration = self._config_handler.get_config_property( AgentConfigurationProperty.CONSTANT_EXPLORATION_PERCENTAGE, AgentConfigurationProperty.CONSTANT_EXPLORATION_PERCENTAGE. prop_type) self._decaying_exploration = self._config_handler.get_config_property( AgentConfigurationProperty.DECAYING_EXPLORATION_PERCENTAGE, AgentConfigurationProperty.DECAYING_EXPLORATION_PERCENTAGE. prop_type) self._max_episodes = self._config_handler.get_config_property( KatConfigurationProperty.MAX_EPISODES, KatConfigurationProperty.MAX_EPISODES.prop_type) self._max_observe_episodes = self._config_handler.get_config_property( AgentConfigurationProperty.MAX_OBSERVE_EPISODES, AgentConfigurationProperty.MAX_OBSERVE_EPISODES.prop_type)
def _load_configuration(self) -> None: """ Loads the configuration. """ config_handler = KatherineApplication.get_application_config() self._is_model_persistence_enabled = config_handler.get_config_property( ModelSerializerProperty.MODEL_PERSISTENCE_ENABLED, ModelSerializerProperty.MODEL_PERSISTENCE_ENABLED.prop_type) self._is_checkpoints_enabled = config_handler.get_config_property( ModelSerializerProperty.MODEL_CHECKPOINTS_ENABLED, ModelSerializerProperty.MODEL_CHECKPOINTS_ENABLED.prop_type)
def __init__(self, name: Optional[str] = None): """Creates an instance of `Network`. Args: name: A string representing the name of the network. """ self._log = logger.get_logger(self.__class__.__name__) self._config_handler = KatherineApplication.get_application_config() self._serializer = KatherineApplication.get_application_factory( ).build_model_serializer() self._name = name or None self._load_configuration()
def __init__(self): """ Default constructor. """ self._log = logger.get_logger(self.__class__.__name__) self._config_handler = KatherineApplication.get_application_config() if not self._config_handler: raise ValueError("No config specified.") self._game = KatherineApplication.get_application_factory().build_game() self._agent = KatherineApplication.get_application_factory().build_agent() self._metrics = KatherineApplication.get_application_factory().build_metrics_tracer() self._load_configuration()
def __init__(self): """ Default constructor. """ self._log = logger.get_logger(self.__class__.__name__) config_handler = KatherineApplication.get_application_config() self.enabled_metrics = config_handler.get_config_property( TensorBoardConfigurationProperty.ENABLED_NETWORK_METRICS, TensorBoardConfigurationProperty.ENABLED_NETWORK_METRICS.prop_type) self.is_profiler_enabled = config_handler.get_config_property( TensorBoardConfigurationProperty.GPU_PROFILER_ENABLED, TensorBoardConfigurationProperty.GPU_PROFILER_ENABLED.prop_type) self.work_directory = fileio.build_metrics_work_directory(WORKING_DIRECTORY_PREFIX) self.initialized = False
def build_global_work_directory() -> str: """ Helper function for building the application's global working directory. base_work_directory/game/agent/run_tag :returns the global work directory path (relative path) """ base_work_directory = KatherineApplication.get_application_config( ).get_config_property(KatConfigurationProperty.WORK_DIRECTORY, KatConfigurationProperty.WORK_DIRECTORY.prop_type) agent_name = KatherineApplication.get_application_config( ).get_config_property(KatConfigurationProperty.AGENT_CLASS, KatConfigurationProperty.AGENT_CLASS.prop_type) game_name = KatherineApplication.get_application_config( ).get_config_property(KatConfigurationProperty.GAME_CLASS, KatConfigurationProperty.GAME_CLASS.prop_type) run_tag = KatherineApplication.get_application_config( ).get_config_property(KatConfigurationProperty.RUN_TAG, KatConfigurationProperty.RUN_TAG.prop_type) agent_name = agent_name[agent_name.rindex('.') + 1:] game_name = game_name[game_name.rindex('.') + 1:] return os.path.join(base_work_directory, game_name, agent_name, run_tag)
def __init__(self): """ Default constructor. """ self._config_handler = KatherineApplication.get_application_config()