"docs/img/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "6c9360a5ab76cfcabd78d6d3333a8b53998a7a9e"
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,8 +509,12 @@ 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]
return {"start": start, "end": end, "example": example, **inputs}
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(
self,
......
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