diff --git a/optimum/exporters/onnx/model_patcher.py b/optimum/exporters/onnx/model_patcher.py index 09cdddc95fe..b9f0df29eaa 100644 --- a/optimum/exporters/onnx/model_patcher.py +++ b/optimum/exporters/onnx/model_patcher.py @@ -412,8 +412,11 @@ def __enter__(self): def __exit__(self, exc_type, exc_value, traceback): # TODO: Remove this if once transformers if much above 4.35 - if AttentionMaskConverter is not None: - AttentionMaskConverter._make_causal_mask = self.original_make_causal + # 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. + # if AttentionMaskConverter is not None: + # AttentionMaskConverter._make_causal_mask = self.original_make_causal + pass def __init__( self,