Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
01c40db4
Unverified
Commit
01c40db4
authored
Jul 20, 2020
by
Sam Shleifer
Committed by
GitHub
Jul 20, 2020
Browse files
[cleanup] squad processor (#5868)
parent
35cb101e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
src/transformers/data/processors/squad.py
src/transformers/data/processors/squad.py
+4
-9
No files found.
src/transformers/data/processors/squad.py
View file @
01c40db4
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment