Esempio n. 1
0
 def pull(self):
     """Requests the center variable and last update from the parameter server."""
     # Request a pull from the parameter server.
     self.socket.sendall(b'p')
     # Fetch the dictionary from the parameter server.
     data = recv_data(self.socket)
     self.center_variable = np.asarray(data['model'])
     self.last_update = data['update']
 def handle_commit(self, conn, addr):
     # Receive the parameters from the remote node.
     data = recv_data(conn)
     # Extract the data from the dictionary.
     r = data['residual']
     with self.mutex:
         # Update the center variable.
         self.center_variable = self.center_variable + r
     # Increment the number of parameter server updates.
     self.next_update()
 def handle_commit(self, conn, addr):
     # Receive the parameters from the remote node.
     data = recv_data(conn)
     # Extract the delta from the dictionary.
     delta = data['delta']
     # Update the center variable with the delta.
     with self.mutex:
         self.center_variable = self.center_variable + delta
     # Next iteration.
     self.next_update()
 def handle_commit(self, conn, addr):
     data = recv_data(conn)
     r = data['residual']
     # Fetch the last iteration number
     last_update = data['last_update']
     du = (self.num_updates - last_update) + 1
     r /= du
     with self.mutex:
         center_variable = self.model.get_weights()
         center_variable = center_variable + r
         self.model.set_weights(center_variable)
     # Increment the number of parameter server updates.
     self.next_update()
 def handle_commit(self, conn, addr):
     # Receive the parameters from the remote node.
     data = recv_data(conn)
     # Extract the data from the dictionary.
     r = data['residual']
     worker_id = data['worker_id']
     stale_cv = data['stale_center_variable']
     with self.mutex:
         diff_cv = np.subtract(self.center_variable, stale_cv)
         d = 1 / (self.inverse_learning_rate * np.power(diff_cv, 2) + 1)
         r = np.multiply(d, r)
         # Update the center variable.
         self.center_variable = self.center_variable + r
     # Increment the number of parameter server updates.
     self.next_update()
Esempio n. 6
0
 def pull(self):
     """Requests the center variable from the parameter server."""
     # Request a pull from the parameter server.
     self.socket.sendall(b'p')
     # Fetch the center variable from the parameter server.
     self.center_variable = np.asarray(recv_data(self.socket))