Exemple #1
0
 def _load_model(self, model_dict):
     model_dict = list(model_dict["model"].values())[0]
     model_obj = _extract_param(model_dict)
     meta_obj = _extract_meta(model_dict)
     self.model_param.restore_from_pb(meta_obj.params)
     self._init_model(self.model_param)
     self.aggregator_iter = meta_obj.aggregate_iter
     self.nn_model = restore_nn_model(self.config_type, model_obj.saved_model_bytes)
Exemple #2
0
def client_load_model(self, meta_obj, model_obj):
    self.model_param.restore_from_pb(meta_obj.params)
    client_set_params(self, self.model_param)
    self.aggregate_iteration_num = meta_obj.aggregate_iter
    self.nn_model = restore_nn_model(self.config_type,
                                     model_obj.saved_model_bytes)
    self._header = list(model_obj.header)
    self._label_align_mapping = {}
    for item in model_obj.label_mapping:
        label = json.loads(item.label)
        mapped = json.loads(item.mapped)
        self._label_align_mapping[label] = mapped
Exemple #3
0
 def load_model(self, model_dict):
     model_dict = list(model_dict["model"].values())[0]
     model_obj = _extract_param(model_dict)
     meta_obj = _extract_meta(model_dict)
     self.model_param.restore_from_pb(meta_obj.params)
     self._init_model(self.model_param)
     self.aggregate_iteration_num = meta_obj.aggregate_iter
     self.nn_model = restore_nn_model(self.config_type, model_obj.saved_model_bytes)
     self._header = list(model_obj.header)
     self._label_align_mapping = {}
     for item in model_obj.label_mapping:
         label = json.loads(item.label)
         mapped = json.loads(item.mapped)
         self._label_align_mapping[label] = mapped
Exemple #4
0
def client_load_model(self, meta_obj, model_obj, is_warm_start_mode):
    self.model_param.restore_from_pb(meta_obj.params, is_warm_start_mode)
    client_set_params(self, self.model_param)
    self.aggregate_iteration_num = meta_obj.aggregate_iter
    self.nn_model = restore_nn_model(self.config_type,
                                     model_obj.saved_model_bytes)
    if self.component_properties.is_warm_start:
        self.nn_model.compile(loss=self.loss,
                              optimizer=self.optimizer,
                              metrics=self.metrics)
    self._header = list(model_obj.header)
    self._label_align_mapping = {}
    for item in model_obj.label_mapping:
        label = json.loads(item.label)
        mapped = json.loads(item.mapped)
        self._label_align_mapping[label] = mapped