Skip to content

Commit

Permalink
fix: add test without key compression
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-stoian-zama committed Jun 13, 2024
1 parent ffbea40 commit 3a8dca0
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/deployment/test_client_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,25 @@ def test_client_server_sklearn_inference(
max_bit_width = fhe_circuit.graph.maximum_integer_bit_width()
print(f"Max width {max_bit_width}")

# Compare the FHE predictions with the clear ones. Simulated predictions are not considered in
# this test.
# Check that key compression is enabled
assert os.environ.get("USE_KEY_COMPRESSION") == "1", "'USE_KEY_COMPRESSION' is not enabled"

# Check with key compression
check_is_good_execution_for_cml_vs_circuit(x_test, model, simulate=False, n_allowed_runs=1)

# Check without key compression
with pytest.MonkeyPatch.context() as mp_context:

# Disable input ciphertext compression
mp_context.setenv("USE_KEY_COMPRESSION", "0")

# Check that input ciphertext compression is disabled
assert os.environ.get("USE_KEY_COMPRESSION") == "0", "'USE_KEY_COMPRESSION' is not disabled"

# Compare the FHE predictions with the clear ones. Simulated predictions are not
# considered in this test.
check_is_good_execution_for_cml_vs_circuit(x_test, model, simulate=False, n_allowed_runs=1)

# Check client/server FHE predictions vs the FHE predictions of the dev model
check_client_server_inference(
x_test, model, key_dir, check_array_equal, check_float_array_equal
Expand Down

0 comments on commit 3a8dca0

Please sign in to comment.