Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
cefd51c5
Commit
cefd51c5
authored
Jan 17, 2020
by
James Betker
Committed by
Lysandre Debut
Jan 20, 2020
Browse files
Fix glue processor failing on tf datasets
parent
ca6ce304
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
src/transformers/data/processors/glue.py
src/transformers/data/processors/glue.py
+6
-2
No files found.
src/transformers/data/processors/glue.py
View file @
cefd51c5
...
@@ -80,11 +80,15 @@ def glue_convert_examples_to_features(
...
@@ -80,11 +80,15 @@ def glue_convert_examples_to_features(
features
=
[]
features
=
[]
for
(
ex_index
,
example
)
in
enumerate
(
examples
):
for
(
ex_index
,
example
)
in
enumerate
(
examples
):
if
ex_index
%
10000
==
0
:
len_examples
=
0
logger
.
info
(
"Writing example %d/%d"
%
(
ex_index
,
len
(
examples
)))
if
is_tf_dataset
:
if
is_tf_dataset
:
example
=
processor
.
get_example_from_tensor_dict
(
example
)
example
=
processor
.
get_example_from_tensor_dict
(
example
)
example
=
processor
.
tfds_map
(
example
)
example
=
processor
.
tfds_map
(
example
)
len_examples
=
tf
.
data
.
experimental
.
cardinality
(
examples
)
else
:
len_examples
=
len
(
examples
)
if
ex_index
%
10000
==
0
:
logger
.
info
(
"Writing example %d/%d"
%
(
ex_index
,
len_examples
))
inputs
=
tokenizer
.
encode_plus
(
example
.
text_a
,
example
.
text_b
,
add_special_tokens
=
True
,
max_length
=
max_length
,)
inputs
=
tokenizer
.
encode_plus
(
example
.
text_a
,
example
.
text_b
,
add_special_tokens
=
True
,
max_length
=
max_length
,)
input_ids
,
token_type_ids
=
inputs
[
"input_ids"
],
inputs
[
"token_type_ids"
]
input_ids
,
token_type_ids
=
inputs
[
"input_ids"
],
inputs
[
"token_type_ids"
]
...
...
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