Skip to content

Commit

Permalink
Fix extrapolation in relative transformer, fix: #1906
Browse files Browse the repository at this point in the history
  • Loading branch information
hankcs committed Sep 8, 2024
1 parent e64efb8 commit 4280529
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hanlp/layers/transformers/relative_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def forward(self, inputs: Tensor):
"""
bsz, seq_len = inputs.size()
max_pos = self.padding_idx + seq_len
if max_pos > self.origin_shift:
if max_pos >= self.origin_shift:
# recompute/expand embeddings if needed
weights = self.get_embedding(
max_pos * 2,
Expand Down
2 changes: 1 addition & 1 deletion hanlp/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Author: hankcs
# Date: 2019-12-28 19:26

__version__ = '2.1.0-beta.60'
__version__ = '2.1.0-beta.61'
"""HanLP version"""


Expand Down

0 comments on commit 4280529

Please sign in to comment.