chore: see the size of the key
Browse files- creating_models.py +11 -0
creating_models.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
import shutil
|
|
|
2 |
from pathlib import Path
|
3 |
|
4 |
from concrete.ml.deployment import FHEModelDev
|
|
|
5 |
|
6 |
|
7 |
def compile_and_make_it_deployable(model_dev, X_train):
|
@@ -16,6 +18,15 @@ def compile_and_make_it_deployable(model_dev, X_train):
|
|
16 |
fhemodel_dev = FHEModelDev(path_to_model, model_dev)
|
17 |
fhemodel_dev.save(via_mlir=True)
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# This is the spam classifier. Taken from https://github.com/zama-ai/concrete-ml/blob/main/docs/advanced_examples/DecisionTreeClassifier.ipynb
|
21 |
import numpy
|
|
|
1 |
import shutil
|
2 |
+
import sys
|
3 |
from pathlib import Path
|
4 |
|
5 |
from concrete.ml.deployment import FHEModelDev
|
6 |
+
from concrete.ml.deployment import FHEModelClient
|
7 |
|
8 |
|
9 |
def compile_and_make_it_deployable(model_dev, X_train):
|
|
|
18 |
fhemodel_dev = FHEModelDev(path_to_model, model_dev)
|
19 |
fhemodel_dev.save(via_mlir=True)
|
20 |
|
21 |
+
# To see the size of the key
|
22 |
+
fhemodel_client = FHEModelClient(path_to_model)
|
23 |
+
|
24 |
+
# Generate the keys
|
25 |
+
fhemodel_client.generate_private_and_evaluation_keys()
|
26 |
+
evaluation_keys = fhemodel_client.get_serialized_evaluation_keys()
|
27 |
+
|
28 |
+
print(f"Your keys will be {sys.getsizeof(evaluation_keys) / 1024 / 1024}-megabytes long")
|
29 |
+
|
30 |
|
31 |
# This is the spam classifier. Taken from https://github.com/zama-ai/concrete-ml/blob/main/docs/advanced_examples/DecisionTreeClassifier.ipynb
|
32 |
import numpy
|