Skip to content

Commit

Permalink
[CI] fix patch_observer_set for PT 1.9 (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjc123 authored May 31, 2024
1 parent 8c1f2ce commit 1e74c0a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tinynn/graph/quantization/quantizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3711,11 +3711,16 @@ def new_no_observer_set():

return new_no_observer_set

if LooseVersion(torch.__version__) >= LooseVersion("1.9.0"):
if LooseVersion(torch.__version__) >= LooseVersion("1.10.0"):
orig_no_observer_set = sys.modules['torch.ao.quantization.quantize'].no_observer_set
sys.modules['torch.ao.quantization.quantize'].no_observer_set = patch_observer_set(
orig_no_observer_set
)
elif LooseVersion(torch.__version__) >= LooseVersion("1.9.0"):
orig_no_observer_set = torch.ao.quantization.quantization_mappings.no_observer_set
torch.ao.quantization.quantization_mappings.no_observer_set = patch_observer_set(
orig_no_observer_set
)

add_observer_func(
graph.module,
Expand Down

0 comments on commit 1e74c0a

Please sign in to comment.