mirror of
https://github.com/saymrwulf/transformers.git
synced 2026-05-14 20:58:08 +00:00
Fix mistral ONNX export (#31696)
* use bitwise or * why is the CI not triggered?
This commit is contained in:
parent
93cd94b79d
commit
57d7594a79
1 changed files with 3 additions and 2 deletions
|
|
@ -1089,8 +1089,9 @@ class MistralModel(MistralPreTrainedModel):
|
|||
exclude_mask = torch.arange(target_length, device=device) > cache_position.reshape(-1, 1)
|
||||
if self.config.sliding_window is not None:
|
||||
if not using_sliding_window_cache or sequence_length > self.config.sliding_window:
|
||||
exclude_mask |= torch.arange(target_length, device=device) <= (
|
||||
cache_position.reshape(-1, 1) - self.config.sliding_window
|
||||
exclude_mask.bitwise_or_(
|
||||
torch.arange(target_length, device=device)
|
||||
<= (cache_position.reshape(-1, 1) - self.config.sliding_window)
|
||||
)
|
||||
causal_mask *= exclude_mask
|
||||
causal_mask = causal_mask[None, None, :, :].expand(input_tensor.shape[0], 1, -1, -1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue