Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ella Charlaix <[email protected]>
  • Loading branch information
eaidova and echarlaix authored Oct 12, 2023
1 parent 47bb44a commit 0a943d9
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions optimum/intel/openvino/modeling_seq2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,7 @@ def forward(
self._compile()

# Model inputs
if input_ids is None and self.main_input_name == "input_ids":
raise RuntimeError("input_ids should be provided")
elif self.main_input_name != "input_ids":
if self.main_input_name not in kwargs:
raise RuntimeError(f"{self.main_input_name} should be provided")
inputs = {self.main_input_name: kwargs[self.main_input_name]}
else:
inputs = {"input_ids": input_ids}
inputs = {self.main_input_name: input_ids}

# Add the attention_mask inputs when needed
if "attention_mask" in self.input_names:
Expand Down Expand Up @@ -576,7 +569,7 @@ def forward(
# Encode if needed (training, first prediction pass)
if encoder_outputs is None:
encoder_outputs = self.encoder(
flattened_patches=flattened_patches,
input_ids=flattened_patches,
attention_mask=attention_mask,
)

Expand Down

0 comments on commit 0a943d9

Please sign in to comment.