Unverified Commit 8a17da2f authored by Wang, Yi's avatar Wang, Yi Committed by GitHub
Browse files

fix the issue that the output dict of jit model could not get [:2] (#21146)



"TypeError: unhashable type: 'slice'"
Signed-off-by: default avatarWang, Yi A <yi.a.wang@intel.com>
Signed-off-by: default avatarWang, Yi A <yi.a.wang@intel.com>
parent e1ad1886
......@@ -509,7 +509,11 @@ class QuestionAnsweringPipeline(ChunkPipeline):
def _forward(self, inputs):
example = inputs["example"]
model_inputs = {k: inputs[k] for k in self.tokenizer.model_input_names}
start, end = self.model(**model_inputs)[:2]
output = self.model(**model_inputs)
if isinstance(output, dict):
return {"start": output["start_logits"], "end": output["end_logits"], "example": example, **inputs}
else:
start, end = output[:2]
return {"start": start, "end": end, "example": example, **inputs}
def postprocess(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment