Add position_ids arg to OPTEmbedding forward function (#6939)

This PR updates the DeepSpeed `OPTEmbedding` forward function to include
a new `positions_ids` argument.

---------

Co-authored-by: Logan Adams <loadams@microsoft.com>
This commit is contained in:
Lev Kurilenko
2025-01-09 12:11:35 -08:00
committed by GitHub
parent 45fce45c95
commit 0fc3daade7
2 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ jobs:
- name: Install deepspeed
run: |
pip install transformers==4.45.2
pip install transformers
pip install .[dev]
ds_report

View File

@ -191,7 +191,7 @@ class OPTEmbedding(EmbeddingLayer):
self.offset = 2
super().__init__(weight_shape, weight=weight)
def forward(self, attention_mask: torch.LongTensor, past_key_values_length: int = 0):
def forward(self, attention_mask: torch.LongTensor, past_key_values_length: int = 0, position_ids: int = 0):
"""`input_ids_shape` is expected to be [bsz x seqlen]."""
attention_mask = attention_mask.long()