def _initialize(self): """Initialize non-common things.""" self.per_beta = self.hyper_params.per_beta self.use_n_step = self.hyper_params.n_step > 1 if not self.args.test: # load demo replay memory with open(self.args.demo_path, "rb") as f: demos = pickle.load(f) if self.use_n_step: demos, demos_n_step = common_utils.get_n_step_info_from_demo( demos, self.hyper_params.n_step, self.hyper_params.gamma) # replay memory for multi-steps self.memory_n = ReplayBuffer( max_len=self.hyper_params.buffer_size, batch_size=self.hyper_params.batch_size, n_step=self.hyper_params.n_step, gamma=self.hyper_params.gamma, demo=demos_n_step, ) # replay memory for a single step self.memory = ReplayBuffer( self.hyper_params.buffer_size, self.hyper_params.batch_size, ) self.memory = PrioritizedBufferWrapper( self.memory, alpha=self.hyper_params.per_alpha) self.learner_cfg.type = "DDPGfDLearner" self.learner = build_learner(self.learner_cfg)
def _initialize(self): """Initialize non-common things.""" if not self.args.test: # load demo replay memory demos = self._load_demos() if self.use_n_step: demos, demos_n_step = common_utils.get_n_step_info_from_demo( demos, self.hyper_params.n_step, self.hyper_params.gamma) self.memory_n = ReplayBuffer( buffer_size=self.hyper_params.buffer_size, n_step=self.hyper_params.n_step, gamma=self.hyper_params.gamma, demo=demos_n_step, ) # replay memory self.memory = PrioritizedReplayBuffer( self.hyper_params.buffer_size, self.hyper_params.batch_size, demo=demos, alpha=self.hyper_params.per_alpha, epsilon_d=self.hyper_params.per_eps_demo, )
def _initialize(self): """Initialize non-common things.""" self.per_beta = self.hyper_params.per_beta self.use_n_step = self.hyper_params.n_step > 1 if not self.args.test: # load demo replay memory with open(self.args.demo_path, "rb") as f: demos = pickle.load(f) if self.use_n_step: demos, demos_n_step = common_utils.get_n_step_info_from_demo( demos, self.hyper_params.n_step, self.hyper_params.gamma) # replay memory for multi-steps self.memory_n = ReplayBuffer( buffer_size=self.hyper_params.buffer_size, batch_size=self.hyper_params.batch_size, n_step=self.hyper_params.n_step, gamma=self.hyper_params.gamma, demo=demos_n_step, ) # replay memory self.memory = PrioritizedReplayBuffer( self.hyper_params.buffer_size, self.hyper_params.batch_size, demo=demos, alpha=self.hyper_params.per_alpha, epsilon_d=self.hyper_params.per_eps_demo, )
def _initialize(self): """Initialize non-common things.""" self.per_beta = self.hyper_params.per_beta self.use_n_step = self.hyper_params.n_step > 1 if not self.is_test: # load demo replay memory with open(self.hyper_params.demo_path, "rb") as f: demos = pickle.load(f) if self.use_n_step: demos, demos_n_step = common_utils.get_n_step_info_from_demo( demos, self.hyper_params.n_step, self.hyper_params.gamma) # replay memory for multi-steps self.memory_n = ReplayBuffer( max_len=self.hyper_params.buffer_size, batch_size=self.hyper_params.batch_size, n_step=self.hyper_params.n_step, gamma=self.hyper_params.gamma, demo=demos_n_step, ) # replay memory for a single step self.memory = ReplayBuffer( self.hyper_params.buffer_size, self.hyper_params.batch_size, demo=demos, ) self.memory = PrioritizedBufferWrapper( self.memory, alpha=self.hyper_params.per_alpha, epsilon_d=self.hyper_params.per_eps_demo, ) build_args = dict( hyper_params=self.hyper_params, log_cfg=self.log_cfg, noise_cfg=self.noise_cfg, env_name=self.env_info.name, state_size=self.env_info.observation_space.shape, output_size=self.env_info.action_space.shape[0], is_test=self.is_test, load_from=self.load_from, ) self.learner = build_learner(self.learner_cfg, build_args)
def _initialize(self): """Initialize non-common things.""" if not self.is_test: # load demo replay memory demos = self._load_demos() if self.use_n_step: demos, demos_n_step = common_utils.get_n_step_info_from_demo( demos, self.hyper_params.n_step, self.hyper_params.gamma) self.memory_n = ReplayBuffer( max_len=self.hyper_params.buffer_size, batch_size=self.hyper_params.batch_size, n_step=self.hyper_params.n_step, gamma=self.hyper_params.gamma, demo=demos_n_step, ) # replay memory self.memory = ReplayBuffer( self.hyper_params.buffer_size, self.hyper_params.batch_size, demo=demos, ) self.memory = PrioritizedBufferWrapper( self.memory, alpha=self.hyper_params.per_alpha, epsilon_d=self.hyper_params.per_eps_demo, ) build_args = dict( hyper_params=self.hyper_params, log_cfg=self.log_cfg, env_name=self.env_info.name, state_size=self.env_info.observation_space.shape, output_size=self.env_info.action_space.n, is_test=self.is_test, load_from=self.load_from, ) self.learner_cfg.type = "DQfDLearner" self.learner = build_learner(self.learner_cfg, build_args)