Skip to content

Commit 34fc6b8

Browse files
tomaarsenKoichiYasuoka
authored andcommitted
Reintroduce Python 3.9 support for ModernBERT (huggingface#35458)
Co-authored-by: Koichi Yasuoka <[email protected]>
1 parent 0c410ae commit 34fc6b8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/transformers/models/modernbert/modeling_modernbert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def eager_attention_forward(
307307
dim: int,
308308
output_attentions: Optional[bool] = False,
309309
**_kwargs,
310-
) -> Tuple[torch.Tensor, torch.Tensor] | Tuple[torch.Tensor]:
310+
) -> Union[Tuple[torch.Tensor, torch.Tensor], Tuple[torch.Tensor]]:
311311
# qkv: [batch_size, seqlen, 3, nheads, headdim]
312312
cos, sin = module.rotary_emb(qkv, position_ids=position_ids)
313313
query, key, value = qkv.transpose(3, 1).unbind(dim=2)

src/transformers/models/modernbert/modular_modernbert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ def eager_attention_forward(
532532
dim: int,
533533
output_attentions: Optional[bool] = False,
534534
**_kwargs,
535-
) -> Tuple[torch.Tensor, torch.Tensor] | Tuple[torch.Tensor]:
535+
) -> Union[Tuple[torch.Tensor, torch.Tensor], Tuple[torch.Tensor]]:
536536
# qkv: [batch_size, seqlen, 3, nheads, headdim]
537537
cos, sin = module.rotary_emb(qkv, position_ids=position_ids)
538538
query, key, value = qkv.transpose(3, 1).unbind(dim=2)

0 commit comments

Comments
 (0)