Skip to content

Commit

Permalink
chore: fix patch
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrery committed Nov 20, 2024
1 parent c5e1e28 commit c4a68e4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/torch/test_hybrid_converter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for the hybrid model converter."""

import importlib
import sys
import tempfile
from pathlib import Path
Expand Down Expand Up @@ -64,14 +65,14 @@ def run_hybrid_llm_test(
if has_pbs_reshape:
has_pbs = True

# Propagate glwe_backend_installed state being tested to constants of affected modules
for affected_module in (
concrete.ml.quantization.linear_op_glwe_backend,
concrete.ml.torch.hybrid_model,
):
m.setattr(affected_module, "_HAS_GLWE_BACKEND", glwe_backend_installed)
# Patching for GLWE backend
if not glwe_backend_installed:
m.setitem(sys.modules, "concrete_ml_extensions", None)

# Reload the affected modules to ensure the changes take effect
importlib.reload(concrete.ml.quantization.linear_op_glwe_backend)
importlib.reload(concrete.ml.torch.hybrid_model)

# Create a hybrid model
hybrid_model = HybridFHEModel(model, module_names)
is_compiled = False
try:
Expand Down

0 comments on commit c4a68e4

Please sign in to comment.