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
ModelZoo
ResNet50_tensorflow
Commits
3b7153f0
Commit
3b7153f0
authored
Aug 16, 2020
by
Chen Chen
Committed by
A. Unique TensorFlower
Aug 16, 2020
Browse files
Internal change
PiperOrigin-RevId: 326935344
parent
52a017db
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
official/nlp/data/question_answering_dataloader.py
official/nlp/data/question_answering_dataloader.py
+2
-0
official/nlp/tasks/question_answering.py
official/nlp/tasks/question_answering.py
+8
-2
No files found.
official/nlp/data/question_answering_dataloader.py
View file @
3b7153f0
...
...
@@ -38,6 +38,8 @@ class QADataConfig(cfg.DataConfig):
input_preprocessed_data_path
:
str
=
''
doc_stride
:
int
=
128
query_length
:
int
=
64
# The path to the vocab file of word piece tokenizer or the
# model of the sentence piece tokenizer.
vocab_file
:
str
=
''
tokenization
:
str
=
'WordPiece'
# WordPiece or SentencePiece
do_lower_case
:
bool
=
True
...
...
official/nlp/tasks/question_answering.py
View file @
3b7153f0
...
...
@@ -139,17 +139,23 @@ class QuestionAnsweringTask(base_task.Task):
kwargs
=
dict
(
examples
=
eval_examples
,
tokenizer
=
tokenization
.
FullTokenizer
(
vocab_file
=
params
.
vocab_file
,
do_lower_case
=
params
.
do_lower_case
),
max_seq_length
=
params
.
seq_length
,
doc_stride
=
params
.
doc_stride
,
max_query_length
=
params
.
query_length
,
is_training
=
False
,
output_fn
=
_append_feature
,
batch_size
=
params
.
global_batch_size
)
if
params
.
tokenization
==
'SentencePiece'
:
# squad_lib_sp requires one more argument 'do_lower_case'.
kwargs
[
'do_lower_case'
]
=
params
.
do_lower_case
kwargs
[
'tokenizer'
]
=
tokenization
.
FullSentencePieceTokenizer
(
sp_model_file
=
params
.
vocab_file
)
elif
params
.
tokenization
==
'WordPiece'
:
kwargs
[
'tokenizer'
]
=
tokenization
.
FullTokenizer
(
vocab_file
=
params
.
vocab_file
,
do_lower_case
=
params
.
do_lower_case
)
else
:
raise
ValueError
(
'Unexpected tokenization: %s'
%
params
.
tokenization
)
eval_dataset_size
=
self
.
squad_lib
.
convert_examples_to_features
(
**
kwargs
)
eval_writer
.
close
()
...
...
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