Skip to content

Commit

Permalink
Fix model patcher ONNX decoder export (#1547)
Browse files Browse the repository at this point in the history
add missing super calls
  • Loading branch information
fxmarty authored Nov 17, 2023
1 parent ea4349d commit 67dd61f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions optimum/exporters/onnx/model_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 67dd61f

Please sign in to comment.