From 67dd61fb8bf525e6c7016cf3f690c55d5116317b Mon Sep 17 00:00:00 2001 From: fxmarty <9808326+fxmarty@users.noreply.github.com> Date: Fri, 17 Nov 2023 16:38:40 +0100 Subject: [PATCH] Fix model patcher ONNX decoder export (#1547) add missing super calls --- optimum/exporters/onnx/model_patcher.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/optimum/exporters/onnx/model_patcher.py b/optimum/exporters/onnx/model_patcher.py index 0dec0db53c..88a40e7a49 100644 --- a/optimum/exporters/onnx/model_patcher.py +++ b/optimum/exporters/onnx/model_patcher.py @@ -408,11 +408,13 @@ def _make_causal_mask_patched( class DecoderModelPatcher(ModelPatcher): def __enter__(self): + super().__enter__() # TODO: Remove this if once transformers if much above 4.35 if AttentionMaskConverter is not None: AttentionMaskConverter._make_causal_mask = _make_causal_mask_patched def __exit__(self, exc_type, exc_value, traceback): + super().__exit__(exc_type, exc_value, traceback) # TODO: Remove this if once transformers if much above 4.35 # TODO: We should unpatch it - however `self._make_causal_mask` may still be called later which raises issues with this simple patch strategy. # We need to find a proper solution.