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
bb124157
Commit
bb124157
authored
Mar 10, 2021
by
stephenwu
Browse files
Merge branch 'master' of
https://github.com/tensorflow/models
into RTESuperGLUE
parents
2e9bb539
0edeb7f6
Changes
386
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
44 additions
and
69 deletions
+44
-69
official/nlp/data/create_finetuning_data.py
official/nlp/data/create_finetuning_data.py
+2
-2
official/nlp/data/create_pretraining_data.py
official/nlp/data/create_pretraining_data.py
+2
-2
official/nlp/data/create_pretraining_data_test.py
official/nlp/data/create_pretraining_data_test.py
+2
-3
official/nlp/data/create_xlnet_pretraining_data.py
official/nlp/data/create_xlnet_pretraining_data.py
+2
-2
official/nlp/data/create_xlnet_pretraining_data_test.py
official/nlp/data/create_xlnet_pretraining_data_test.py
+2
-3
official/nlp/data/data_loader.py
official/nlp/data/data_loader.py
+2
-2
official/nlp/data/data_loader_factory.py
official/nlp/data/data_loader_factory.py
+2
-3
official/nlp/data/data_loader_factory_test.py
official/nlp/data/data_loader_factory_test.py
+2
-3
official/nlp/data/pretrain_dataloader.py
official/nlp/data/pretrain_dataloader.py
+2
-3
official/nlp/data/pretrain_dataloader_test.py
official/nlp/data/pretrain_dataloader_test.py
+2
-3
official/nlp/data/question_answering_dataloader.py
official/nlp/data/question_answering_dataloader.py
+2
-3
official/nlp/data/question_answering_dataloader_test.py
official/nlp/data/question_answering_dataloader_test.py
+2
-3
official/nlp/data/sentence_prediction_dataloader.py
official/nlp/data/sentence_prediction_dataloader.py
+6
-17
official/nlp/data/sentence_prediction_dataloader_test.py
official/nlp/data/sentence_prediction_dataloader_test.py
+2
-6
official/nlp/data/sentence_retrieval_lib.py
official/nlp/data/sentence_retrieval_lib.py
+2
-2
official/nlp/data/squad_lib.py
official/nlp/data/squad_lib.py
+2
-2
official/nlp/data/squad_lib_sp.py
official/nlp/data/squad_lib_sp.py
+2
-2
official/nlp/data/tagging_data_lib.py
official/nlp/data/tagging_data_lib.py
+2
-2
official/nlp/data/tagging_data_lib_test.py
official/nlp/data/tagging_data_lib_test.py
+2
-3
official/nlp/data/tagging_dataloader.py
official/nlp/data/tagging_dataloader.py
+2
-3
No files found.
official/nlp/data/create_finetuning_data.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""BERT finetuning task dataset generator."""
import
functools
...
...
official/nlp/data/create_pretraining_data.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Create masked LM/next sentence masked_lm TF examples for BERT."""
import
collections
...
...
official/nlp/data/create_pretraining_data_test.py
View file @
bb124157
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for official.nlp.data.create_pretraining_data."""
import
random
...
...
official/nlp/data/create_xlnet_pretraining_data.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Create LM TF examples for XLNet."""
import
json
...
...
official/nlp/data/create_xlnet_pretraining_data_test.py
View file @
bb124157
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for official.nlp.data.create_xlnet_pretraining_data."""
import
os
import
tempfile
...
...
official/nlp/data/data_loader.py
View file @
bb124157
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""An abstraction that NLP models define input pipelines."""
import
abc
...
...
official/nlp/data/data_loader_factory.py
View file @
bb124157
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""A global factory to access NLP registered data loaders."""
from
official.core
import
registry
...
...
official/nlp/data/data_loader_factory_test.py
View file @
bb124157
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for official.nlp.data.data_loader_factory."""
import
dataclasses
...
...
official/nlp/data/pretrain_dataloader.py
View file @
bb124157
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Loads dataset for the BERT pretraining task."""
from
typing
import
Mapping
,
Optional
...
...
official/nlp/data/pretrain_dataloader_test.py
View file @
bb124157
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for official.nlp.data.pretrain_dataloader."""
import
itertools
import
os
...
...
official/nlp/data/question_answering_dataloader.py
View file @
bb124157
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Loads dataset for the question answering (e.g, SQuAD) task."""
from
typing
import
Mapping
,
Optional
...
...
official/nlp/data/question_answering_dataloader_test.py
View file @
bb124157
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for official.nlp.data.question_answering_dataloader."""
import
os
...
...
official/nlp/data/sentence_prediction_dataloader.py
View file @
bb124157
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,8 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Loads dataset for the sentence prediction (classification) task."""
import
functools
from
typing
import
List
,
Mapping
,
Optional
import
dataclasses
...
...
@@ -137,20 +137,9 @@ class TextProcessor(tf.Module):
if
preprocessing_hub_module_url
:
self
.
_preprocessing_hub_module
=
hub
.
load
(
preprocessing_hub_module_url
)
self
.
_tokenizer
=
self
.
_preprocessing_hub_module
.
tokenize
def
set_shape
(
t
):
# Before TF2.4, the sequence length dimension loaded from the
# preprocessing hub module is None, so we recover the shape here.
# TODO(b/157636658): Remove once TF2.4 is released and being used.
t
.
set_shape
([
None
,
seq_length
])
return
t
def
pack_inputs_fn
(
inputs
):
result
=
self
.
_preprocessing_hub_module
.
bert_pack_inputs
(
inputs
,
seq_length
=
seq_length
)
result
=
tf
.
nest
.
map_structure
(
set_shape
,
result
)
return
result
self
.
_pack_inputs
=
pack_inputs_fn
self
.
_pack_inputs
=
functools
.
partial
(
self
.
_preprocessing_hub_module
.
bert_pack_inputs
,
seq_length
=
seq_length
)
return
if
tokenization
==
'WordPiece'
:
...
...
official/nlp/data/sentence_prediction_dataloader_test.py
View file @
bb124157
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for official.nlp.data.sentence_prediction_dataloader."""
import
os
...
...
@@ -164,7 +163,6 @@ class SentencePredictionTfdsDataLoaderTest(tf.test.TestCase,
input_path
=
''
if
use_tfds
else
tf_record_path
,
tfds_name
=
'glue/mrpc'
if
use_tfds
else
''
,
tfds_split
=
'train'
if
use_tfds
else
''
,
tfds_download
=
True
,
text_fields
=
text_fields
,
global_batch_size
=
batch_size
,
seq_length
=
seq_length
,
...
...
@@ -196,7 +194,6 @@ class SentencePredictionTfdsDataLoaderTest(tf.test.TestCase,
input_path
=
''
if
use_tfds
else
tf_record_path
,
tfds_name
=
'glue/mrpc'
if
use_tfds
else
''
,
tfds_split
=
'train'
if
use_tfds
else
''
,
tfds_download
=
True
,
text_fields
=
text_fields
,
global_batch_size
=
batch_size
,
seq_length
=
seq_length
,
...
...
@@ -230,7 +227,6 @@ class SentencePredictionTfdsDataLoaderTest(tf.test.TestCase,
input_path
=
''
if
use_tfds
else
tf_record_path
,
tfds_name
=
'glue/mrpc'
if
use_tfds
else
''
,
tfds_split
=
'train'
if
use_tfds
else
''
,
tfds_download
=
True
,
text_fields
=
text_fields
,
global_batch_size
=
batch_size
,
seq_length
=
seq_length
,
...
...
official/nlp/data/sentence_retrieval_lib.py
View file @
bb124157
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""BERT library to process data for cross lingual sentence retrieval task."""
import
os
...
...
official/nlp/data/squad_lib.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Library to process data for SQuAD 1.1 and SQuAD 2.0."""
# pylint: disable=g-bad-import-order
import
collections
...
...
official/nlp/data/squad_lib_sp.py
View file @
bb124157
# Copyright 201
9
The TensorFlow Authors. All Rights Reserved.
# Copyright 20
2
1 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Run ALBERT on SQuAD 1.1 and SQuAD 2.0 using sentence piece tokenization.
The file is forked from:
...
...
official/nlp/data/tagging_data_lib.py
View file @
bb124157
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Library to process data for tagging task such as NER/POS."""
import
collections
import
os
...
...
official/nlp/data/tagging_data_lib_test.py
View file @
bb124157
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for official.nlp.data.tagging_data_lib."""
import
os
import
random
...
...
official/nlp/data/tagging_dataloader.py
View file @
bb124157
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Loads dataset for the tagging (e.g., NER/POS) task."""
from
typing
import
Mapping
,
Optional
...
...
Prev
1
2
3
4
5
6
7
8
…
20
Next
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