Skip to content

Commit 471cf1d

Browse files
clean pipeline question_answering. (#36986)
Signed-off-by: zhanluxianshen <[email protected]>
1 parent 29f322d commit 471cf1d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/transformers/pipelines/question_answering.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ def _sanitize_parameters(
340340
if max_answer_len is not None:
341341
if max_answer_len < 1:
342342
raise ValueError(f"max_answer_len parameter should be >= 1 (got {max_answer_len}")
343-
if max_answer_len is not None:
344343
postprocess_params["max_answer_len"] = max_answer_len
345344
if handle_impossible_answer is not None:
346345
postprocess_params["handle_impossible_answer"] = handle_impossible_answer
@@ -542,11 +541,9 @@ def postprocess(
542541
for output in model_outputs:
543542
if self.framework == "pt" and output["start"].dtype == torch.bfloat16:
544543
start_ = output["start"].to(torch.float32)
545-
else:
546-
start_ = output["start"]
547-
if self.framework == "pt" and output["start"].dtype == torch.bfloat16:
548544
end_ = output["end"].to(torch.float32)
549545
else:
546+
start_ = output["start"]
550547
end_ = output["end"]
551548
example = output["example"]
552549
p_mask = output["p_mask"]

0 commit comments

Comments
 (0)