コード例 #1
0
 def send_message_sync_model_to_client(self, receive_id,
                                       global_model_params):
     message = Message(MyMessage.MSG_TYPE_S2C_SYNC_MODEL_TO_CLIENT,
                       self.get_sender_id(), receive_id)
     message.add_params(MyMessage.MSG_ARG_KEY_MODEL_PARAMS,
                        global_model_params)
     self.send_message(message)
コード例 #2
0
 def send_result_to_neighbors(self, receive_id, client_params1):
     logging.info("send_result_to_neighbors. receive_id = " +
                  str(receive_id))
     message = Message(MyMessage.MSG_TYPE_SEND_MSG_TO_NEIGHBOR,
                       self.get_sender_id(), receive_id)
     message.add_params(MyMessage.MSG_ARG_KEY_PARAMS_1, client_params1)
     self.send_message(message)
コード例 #3
0
 def send_model_to_server(self, receive_id, weights, local_sample_num,
                          train_acc, train_loss):
     message = Message(MyMessage.MSG_TYPE_C2S_SEND_MODEL_TO_SERVER,
                       self.get_sender_id(), receive_id)
     message.add_params(MyMessage.MSG_ARG_KEY_MODEL_PARAMS, weights)
     message.add_params(MyMessage.MSG_ARG_KEY_NUM_SAMPLES, local_sample_num)
     message.add_params(MyMessage.MSG_ARG_KEY_LOCAL_TRAINING_ACC, train_acc)
     message.add_params(MyMessage.MSG_ARG_KEY_LOCAL_TRAINING_LOSS,
                        train_loss)
     self.send_message(message)
コード例 #4
0
 def send_model_to_server(self, receive_id, host_train_logits,
                          host_test_logits):
     message = Message(MyMessage.MSG_TYPE_C2S_LOGITS, self.get_sender_id(),
                       receive_id)
     message.add_params(MyMessage.MSG_ARG_KEY_TRAIN_LOGITS,
                        host_train_logits)
     message.add_params(MyMessage.MSG_ARG_KEY_TEST_LOGITS, host_test_logits)
     self.send_message(message)
コード例 #5
0
 def __send_initial_config_to_client(self, process_id, global_model_params,
                                     global_arch_params):
     message = Message(MyMessage.MSG_TYPE_S2C_INIT_CONFIG,
                       self.get_sender_id(), process_id)
     message.add_params(MyMessage.MSG_ARG_KEY_MODEL_PARAMS,
                        global_model_params)
     message.add_params(MyMessage.MSG_ARG_KEY_ARCH_PARAMS,
                        global_arch_params)
     logging.info("MSG_TYPE_S2C_INIT_CONFIG. receiver: " + str(process_id))
     self.send_message(message)
コード例 #6
0
 def __send_model_to_client_message(self, process_id, global_model_params,
                                    global_arch_params):
     message = Message(MyMessage.MSG_TYPE_S2C_SYNC_MODEL_TO_CLIENT, 0,
                       process_id)
     message.add_params(MyMessage.MSG_ARG_KEY_MODEL_PARAMS,
                        global_model_params)
     message.add_params(MyMessage.MSG_ARG_KEY_ARCH_PARAMS,
                        global_arch_params)
     logging.info(
         "__send_model_to_client_message. MSG_TYPE_S2C_SYNC_MODEL_TO_CLIENT. receiver: "
         + str(process_id))
     self.send_message(message)
コード例 #7
0
ファイル: client_manager.py プロジェクト: yanfangli1986/FedML
 def send_model_to_server(self, receive_id, client_gradient):
     message = Message(MyMessage.MSG_TYPE_C2S_INFORMATION,
                       self.get_sender_id(), receive_id)
     message.add_params(MyMessage.MSG_ARG_KEY_INFORMATION, client_gradient)
     self.send_message(message)
コード例 #8
0
 def send_message_to_client(self, receive_id, global_result):
     message = Message(MyMessage.MSG_TYPE_S2C_INFORMATION,
                       self.get_sender_id(), receive_id)
     message.add_params(MyMessage.MSG_ARG_KEY_INFORMATION, global_result)
     self.send_message(message)
コード例 #9
0
 def send_message_init_config(self, receive_id):
     message = Message(MyMessage.MSG_TYPE_S2C_INIT_CONFIG,
                       self.get_sender_id(), receive_id)
     self.send_message(message)
コード例 #10
0
 def __send_msg_fedavg_send_model_to_server(self, weights, alphas,
                                            local_sample_num, valid_acc,
                                            valid_loss):
     message = Message(MyMessage.MSG_TYPE_C2S_SEND_MODEL_TO_SERVER,
                       self.rank, 0)
     message.add_params(MyMessage.MSG_ARG_KEY_NUM_SAMPLES, local_sample_num)
     message.add_params(MyMessage.MSG_ARG_KEY_MODEL_PARAMS, weights)
     message.add_params(MyMessage.MSG_ARG_KEY_ARCH_PARAMS, alphas)
     message.add_params(MyMessage.MSG_ARG_KEY_LOCAL_TRAINING_ACC, valid_acc)
     message.add_params(MyMessage.MSG_ARG_KEY_LOCAL_TRAINING_LOSS,
                        valid_loss)
     self.send_message(message)
コード例 #11
0
 def send_message_init_config(self, receive_id, global_model_params):
     message = Message(MyMessage.MSG_TYPE_S2C_INIT_CONFIG,
                       self.get_sender_id(), receive_id)
     message.add_params(MyMessage.MSG_ARG_KEY_MODEL_PARAMS,
                        global_model_params)
     self.send_message(message)