Skip to content

Commit

Permalink
Update modeling.py
Browse files Browse the repository at this point in the history
  • Loading branch information
changwangss authored Nov 27, 2023
1 parent 34e85a2 commit f95dea1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion optimum/intel/generation/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ def forward(

if position_ids is not None and model_type in MODEL_TYPES_REQUIRING_POSITION_IDS:
inputs["position_ids"] = position_ids

if position_ids is None and model_type in MODEL_TYPES_REQUIRING_POSITION_IDS:
position_ids = torch.arange(input_ids.shape[1]).repeat(input_ids.shape[0], 1)
inputs["position_ids"] = position_ids
outputs = self.model(**inputs)

if isinstance(outputs, (list, tuple)):
Expand Down

0 comments on commit f95dea1

Please sign in to comment.