Unverified Commit 01c40db4 authored by Sam Shleifer's avatar Sam Shleifer Committed by GitHub
Browse files

[cleanup] squad processor (#5868)

parent 35cb101e
...@@ -620,11 +620,7 @@ class SquadProcessor(DataProcessor): ...@@ -620,11 +620,7 @@ class SquadProcessor(DataProcessor):
answer_text = None answer_text = None
answers = [] answers = []
if "is_impossible" in qa: is_impossible = qa.get("is_impossible", False)
is_impossible = qa["is_impossible"]
else:
is_impossible = False
if not is_impossible: if not is_impossible:
if is_training: if is_training:
answer = qa["answers"][0] answer = qa["answers"][0]
...@@ -643,7 +639,6 @@ class SquadProcessor(DataProcessor): ...@@ -643,7 +639,6 @@ class SquadProcessor(DataProcessor):
is_impossible=is_impossible, is_impossible=is_impossible,
answers=answers, answers=answers,
) )
examples.append(example) examples.append(example)
return examples return examples
...@@ -658,7 +653,7 @@ class SquadV2Processor(SquadProcessor): ...@@ -658,7 +653,7 @@ class SquadV2Processor(SquadProcessor):
dev_file = "dev-v2.0.json" dev_file = "dev-v2.0.json"
class SquadExample(object): class SquadExample:
""" """
A single training/test example for the Squad dataset, as loaded from disk. A single training/test example for the Squad dataset, as loaded from disk.
...@@ -721,7 +716,7 @@ class SquadExample(object): ...@@ -721,7 +716,7 @@ class SquadExample(object):
] ]
class SquadFeatures(object): class SquadFeatures:
""" """
Single squad example features to be fed to a model. Single squad example features to be fed to a model.
Those features are model-specific and can be crafted from :class:`~transformers.data.processors.squad.SquadExample` Those features are model-specific and can be crafted from :class:`~transformers.data.processors.squad.SquadExample`
...@@ -783,7 +778,7 @@ class SquadFeatures(object): ...@@ -783,7 +778,7 @@ class SquadFeatures(object):
self.qas_id = qas_id self.qas_id = qas_id
class SquadResult(object): class SquadResult:
""" """
Constructs a SquadResult which can be used to evaluate a model's output on the SQuAD dataset. Constructs a SquadResult which can be used to evaluate a model's output on the SQuAD dataset.
......
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