From 304d9918fd50df56ac5436808871cd7f74079b48 Mon Sep 17 00:00:00 2001 From: IlyasMoutawwakil Date: Tue, 2 Jul 2024 17:53:26 +0200 Subject: [PATCH] remove bitwise inplace op --- optimum/exporters/onnx/model_patcher.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/optimum/exporters/onnx/model_patcher.py b/optimum/exporters/onnx/model_patcher.py index f3a3ad78db..5e720d0cd7 100644 --- a/optimum/exporters/onnx/model_patcher.py +++ b/optimum/exporters/onnx/model_patcher.py @@ -1031,9 +1031,10 @@ def _update_causal_mask_patched( if self.config.sliding_window is not None: if not using_sliding_window_cache or sequence_length > self.config.sliding_window: # ---------------- NOTE: This part is patched ----------------------------- - exclude_mask.bitwise_or_( + exclude_mask = torch.bitwise_or( + exclude_mask, torch.arange(target_length, device=device) - <= (cache_position.reshape(-1, 1) - self.config.sliding_window) + <= (cache_position.reshape(-1, 1) - self.config.sliding_window), ) # ---------------- NOTE: patch end ----------------------------------------