concrete.ml.deployment.fhe_client_server.md
module concrete.ml.deployment.fhe_client_server
concrete.ml.deployment.fhe_client_serverAPIs for FHE deployment.
Global Variables
CML_VERSION
AVAILABLE_MODEL
class FHEModelServer
FHEModelServerServer API to load and run the FHE circuit.
method __init__
__init____init__(path_dir: str)Initialize the FHE API.
Args:
path_dir(str): the path to the directory where the circuit is saved
method load
loadLoad the circuit.
method run
runRun the model on the server over encrypted data.
Args:
serialized_encrypted_quantized_data(cnp.PublicArguments): the encrypted, quantized and serialized dataserialized_evaluation_keys(cnp.EvaluationKeys): the serialized evaluation keys
Returns:
cnp.PublicResult: the result of the model
class FHEModelDev
FHEModelDevDev API to save the model and then load and run the FHE circuit.
method __init__
__init__Initialize the FHE API.
Args:
path_dir(str): the path to the directory where the circuit is savedmodel(Any): the model to use for the FHE API
method save
saveExport all needed artifacts for the client and server.
Raises:
Exception: path_dir is not empty
class FHEModelClient
FHEModelClientClient API to encrypt and decrypt FHE data.
method __init__
__init__Initialize the FHE API.
Args:
path_dir(str): the path to the directory where the circuit is savedkey_dir(str): the path to the directory where the keys are stored
method deserialize_decrypt
deserialize_decryptDeserialize and decrypt the values.
Args:
serialized_encrypted_quantized_result(cnp.PublicArguments): the serialized, encrypted and quantized result
Returns:
numpy.ndarray: the decrypted and deserialized values
method deserialize_decrypt_dequantize
deserialize_decrypt_dequantizeDeserialize, decrypt and dequantize the values.
Args:
serialized_encrypted_quantized_result(cnp.PublicArguments): the serialized, encrypted and quantized result
Returns:
numpy.ndarray: the decrypted (dequantized) values
method generate_private_and_evaluation_keys
generate_private_and_evaluation_keysGenerate the private and evaluation keys.
Args:
force(bool): if True, regenerate the keys even if they already exist
method get_serialized_evaluation_keys
get_serialized_evaluation_keysGet the serialized evaluation keys.
Returns:
cnp.EvaluationKeys: the evaluation keys
method load
loadLoad the quantizers along with the FHE specs.
method quantize_encrypt_serialize
quantize_encrypt_serializeQuantize, encrypt and serialize the values.
Args:
x(numpy.ndarray): the values to quantize, encrypt and serialize
Returns:
cnp.PublicArguments: the quantized, encrypted and serialized values
Last updated
Was this helpful?