Unverified Commit 2eb596f0 authored by Marta Maślankowska's avatar Marta Maślankowska Committed by GitHub
Browse files

Fix p_mask cls token masking in qa pipeline (#10863)

parent eb330e89
......@@ -268,7 +268,7 @@ class QuestionAnsweringPipeline(Pipeline):
)
# keep the cls_token unmasked (some models use it to indicate unanswerable questions)
if self.tokenizer.cls_token_id:
if self.tokenizer.cls_token_id is not None:
cls_index = np.nonzero(encoded_inputs["input_ids"] == self.tokenizer.cls_token_id)
p_mask[cls_index] = 0
......
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