Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fxmarty committed Jul 1, 2024
1 parent 5454cec commit 1015094
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions optimum/onnxruntime/modeling_ort.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,9 +1092,10 @@ def forward(
model_outputs = self._prepare_onnx_outputs(use_torch, *onnx_outputs)

if "last_hidden_state" in self.output_names:
last_hidden_state = model_outputs[self.output_names["last_hidden_state"]]
last_hidden_state = model_outputs["last_hidden_state"]
else:
last_hidden_state = model_outputs[0]
# TODO: This allows to support sentence-transformers models (sentence embedding), but is not validated.
last_hidden_state = next(iter(model_outputs.values()))

# converts output to namedtuple for pipelines post-processing
return BaseModelOutput(last_hidden_state=last_hidden_state)
Expand Down

0 comments on commit 1015094

Please sign in to comment.