grid.grid_network¶
Module Contents¶
-
grid.grid_network.SMPC_HOST_CHUNK= 4¶
-
class
grid.grid_network.GridNetwork(gateway_url)¶ Bases:
objectThe purpose of the Grid Network class is to control the entire communication flow by abstracting operational steps.
-
- gateway_url network address to which you want to connect.
-
- connected_grid_nodes Grid nodes that are connected to the application.
-
search(self, *query)¶ Search a set of tags across the grid network.
Parameters: query – A set of dataset tags. Returns: matrix of tensor pointers. Return type: tensor_matrix
-
serve_encrypted_model(self, model)¶ This method wiil choose some grid nodes at grid network to host an encrypted model.
Parameters: model – Model to be hosted. - Raise:
- RuntimeError : If grid network doesn’t have enough workers to host an encrypted model.
-
serve_model(self, model, model_id, allow_remote_inference: bool = False, allow_download: bool = False)¶ This method will choose one of grid nodes registered in the grid network to host a plain text model. :param model: Model to be hosted. :param model_id: Model’s ID. :param allow_remote_inference: Allow workers to run inference in this model. :param allow_download: Allow workers to copy the model and run it locally.
-
run_encrypted_inference(self, model_id, data, copy=True)¶ Search for an encrypted model and perform inference.
Parameters: - model_id – Model’s ID.
- data – Dataset to be shared/inferred.
- copy – Boolean flag to perform encrypted inference without lose plan.
Returns: Inference’s result.
Return type: Tensor
-
run_remote_inference(self, model_id, data)¶ This method will search for a specific model registered on grid network, if found, It will run inference. :param model_id: Model’s ID. :param dataset: Data used to run inference.
Returns: Inference’s result. Return type: Tensor
-
query_model(self, model_id)¶ This method will search for a specific model registered on grid network, if found, It will return all grid nodes that contains the desired model. :param model_id: Model’s ID. :param data: Data used to run inference.
Returns: List of workers that contains the desired model. Return type: workers
-
__connect_with_node(self, node_id, node_url)¶
-
disconnect_nodes(self)¶
-