def create_model(self, model_info): """Create Deep-Q network.""" model_config = model_info['model_config'] zeus_model_name = model_config['zeus_model_name'] model_cls = ClassFactory.get_cls(ClassType.SEARCH_SPACE, zeus_model_name) zeus_model = model_cls(state_dim=self.state_dim, action_dim=self.action_dim) # zeus_model = DqnMlpNet(state_dim=self.state_dim, action_dim=self.action_dim) LossConfig.type = model_config['loss'] OptimConfig.type = model_config['optim'] OptimConfig.params.update({'lr': model_config['lr']}) loss_input = dict() loss_input['inputs'] = [{ "name": "input_state", "type": "float32", "shape": self.state_dim }] loss_input['labels'] = [{ "name": "target_value", "type": "float32", "shape": self.action_dim }] model = Trainer(model=zeus_model, backend='tensorflow', device='GPU', loss_input=loss_input, lazy_build=False) return model
def create_model(self, model_info): """Create Deep-Q network.""" zeus_model = DqnMlpNet(state_dim=self.state_dim, action_dim=self.action_dim) LossConfig.type = 'mse_loss' OptimConfig.type = 'Adam' OptimConfig.params.update({'lr': self.learning_rate}) loss_input = dict() loss_input['inputs'] = [{ "name": "input_state", "type": "float32", "shape": self.state_dim }] loss_input['labels'] = [{ "name": "target_value", "type": "float32", "shape": self.action_dim }] model = Trainer(model=zeus_model, backend='tensorflow', device='GPU', loss_input=loss_input, lazy_build=False) return model
def create_model(self, model_info): zeus_model = PpoMlpNet(state_dim=self.state_dim, action_dim=self.action_dim) LossConfig.type = 'ppo_loss' OptimConfig.type = 'Adam' OptimConfig.params.update({'lr': LR}) loss_input = dict() loss_input['inputs'] = [{"name": "input_state", "type": "float32", "shape": self.state_dim}] loss_input['labels'] = [{"name": "old_v", "type": "float32", "shape": 1}] loss_input['labels'].append({"name": "target_v", "type": "float32", "shape": 1}) loss_input['labels'].append({"name": "old_p", "type": "float32", "shape": self.action_dim}) loss_input['labels'].append({"name": "target_p", "type": "int32", "shape": 1}) loss_input['labels'].append({"name": "adv", "type": "float32", "shape": 1}) model = Trainer(model=zeus_model, lazy_build=False, loss_input=loss_input) return model
def create_model(self, model_info): """Create zeus network.""" zeus_model = ImpalaMlpNet(state_dim=self.state_dim, action_dim=self.action_dim) LossConfig.type = 'impala_loss' OptimConfig.type = 'Adam' OptimConfig.params.update({'lr': LR}) loss_input = dict() loss_input['inputs'] = [{"name": "input_state", "type": "float32", "shape": self.state_dim}] loss_input['labels'] = [{"name": "target_p", "type": "float32", "shape": self.action_dim}] loss_input['labels'].append({"name": "target_v", "type": "float32", "shape": 1}) loss_input['labels'].append({"name": "adv", "type": "float32", "shape": 1}) model = Trainer(model=zeus_model, backend='tensorflow', device='GPU', loss_input=loss_input, lazy_build=False) return model