You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Position ids in RoBERTa is not implemented properly.
The problem arises when using:
create_position_ids_from_input_ids in transformers.models.roberta.modeling_roberta.py
Based on this function, position id 0 is never used. This may cause problem when the sequence is long, for example, 512. Token whose id >= 511 will not get its corresponding token ids.
RoBERTa never uses 0 and 1 positional ids, in ROBERTa, all pad tokens have position id of 1, and the rest of the tokens have position ids in the range (2, seq_length - num_pad_tokens). It's implemented like this to match the original implementation in fairseq.
Reacted by Pan Yinxu, Yx Wei, Oran-Ac, Sayak Paul, kongds, Tuan Anh Nguyen Dang and Mingjie Sun
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Activity
NielsRogge commentedon Mar 16, 2021
There's a reason why position ids don't start at 0 for RoBERTa, see #5285
patil-suraj commentedon Mar 16, 2021
RoBERTanever uses 0 and 1 positional ids, inROBERTa, all pad tokens have position id of 1, and the rest of the tokens have position ids in the range(2, seq_length - num_pad_tokens). It's implemented like this to match the original implementation in fairseq.github-actions commentedon Apr 15, 2021
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.