2345
Browse files
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
app.py
CHANGED
@@ -24,10 +24,12 @@ def load_model(model_path, device):
|
|
24 |
|
25 |
def load_secure_model(model):
|
26 |
print("Compiling secure model...")
|
27 |
-
secure_model = compile_torch_model(
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
31 |
return secure_model
|
32 |
|
33 |
# Image preprocessing (match with the transforms used during training)
|
|
|
24 |
|
25 |
def load_secure_model(model):
|
26 |
print("Compiling secure model...")
|
27 |
+
secure_model = compile_torch_model(
|
28 |
+
model.to("cpu"),
|
29 |
+
n_bits={"model_inputs": 4, "op_inputs": 3, "op_weights": 3, "model_outputs": 5},
|
30 |
+
rounding_threshold_bits={"n_bits": 7, "method": "APPROXIMATE"},
|
31 |
+
torch_inputset=torch.rand(10, 3, 224, 224)
|
32 |
+
)
|
33 |
return secure_model
|
34 |
|
35 |
# Image preprocessing (match with the transforms used during training)
|