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
d7511194
Unverified
Commit
d7511194
authored
Jan 22, 2022
by
Srihari Humbarwadi
Committed by
GitHub
Jan 22, 2022
Browse files
Merge branch 'tensorflow:master' into panoptic-deeplab-modeling
parents
2ad1ec15
ab8b8012
Changes
1000
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
42 additions
and
30 deletions
+42
-30
official/nlp/configs/pretraining_experiments.py
official/nlp/configs/pretraining_experiments.py
+1
-1
official/nlp/configs/wmt_transformer_experiments.py
official/nlp/configs/wmt_transformer_experiments.py
+1
-1
official/nlp/continuous_finetune_lib.py
official/nlp/continuous_finetune_lib.py
+1
-1
official/nlp/continuous_finetune_lib_test.py
official/nlp/continuous_finetune_lib_test.py
+1
-1
official/nlp/data/__init__.py
official/nlp/data/__init__.py
+1
-1
official/nlp/data/classifier_data_lib.py
official/nlp/data/classifier_data_lib.py
+2
-2
official/nlp/data/classifier_data_lib_test.py
official/nlp/data/classifier_data_lib_test.py
+2
-2
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
+1
-1
official/nlp/data/create_xlnet_pretraining_data.py
official/nlp/data/create_xlnet_pretraining_data.py
+3
-3
official/nlp/data/create_xlnet_pretraining_data_test.py
official/nlp/data/create_xlnet_pretraining_data_test.py
+1
-1
official/nlp/data/data_loader.py
official/nlp/data/data_loader.py
+1
-1
official/nlp/data/data_loader_factory.py
official/nlp/data/data_loader_factory.py
+1
-1
official/nlp/data/data_loader_factory_test.py
official/nlp/data/data_loader_factory_test.py
+1
-1
official/nlp/data/dual_encoder_dataloader.py
official/nlp/data/dual_encoder_dataloader.py
+1
-1
official/nlp/data/dual_encoder_dataloader_test.py
official/nlp/data/dual_encoder_dataloader_test.py
+1
-1
official/nlp/data/pretrain_dataloader.py
official/nlp/data/pretrain_dataloader.py
+1
-1
official/nlp/data/pretrain_dataloader_test.py
official/nlp/data/pretrain_dataloader_test.py
+1
-1
official/nlp/data/pretrain_dynamic_dataloader.py
official/nlp/data/pretrain_dynamic_dataloader.py
+17
-5
No files found.
Too many changes to show.
To preserve performance only
1000 of 1000+
files are displayed.
Plain diff
Email patch
official/nlp/configs/pretraining_experiments.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/configs/wmt_transformer_experiments.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/continuous_finetune_lib.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/continuous_finetune_lib_test.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/data/__init__.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/data/classifier_data_lib.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
@@ -24,7 +24,7 @@ from absl import logging
import
tensorflow
as
tf
import
tensorflow_datasets
as
tfds
from
official.nlp.
bert
import
tokenization
from
official.nlp.
tools
import
tokenization
class
InputExample
(
object
):
...
...
official/nlp/data/classifier_data_lib_test.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
@@ -21,8 +21,8 @@ from absl.testing import parameterized
import
tensorflow
as
tf
import
tensorflow_datasets
as
tfds
from
official.nlp.bert
import
tokenization
from
official.nlp.data
import
classifier_data_lib
from
official.nlp.tools
import
tokenization
def
decode_record
(
record
,
name_to_features
):
...
...
official/nlp/data/create_finetuning_data.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
@@ -22,7 +22,6 @@ import os
from
absl
import
app
from
absl
import
flags
import
tensorflow
as
tf
from
official.nlp.bert
import
tokenization
from
official.nlp.data
import
classifier_data_lib
from
official.nlp.data
import
sentence_retrieval_lib
# word-piece tokenizer based squad_lib
...
...
@@ -30,6 +29,7 @@ from official.nlp.data import squad_lib as squad_lib_wp
# sentence-piece tokenizer based squad_lib
from
official.nlp.data
import
squad_lib_sp
from
official.nlp.data
import
tagging_data_lib
from
official.nlp.tools
import
tokenization
FLAGS
=
flags
.
FLAGS
...
...
official/nlp/data/create_pretraining_data.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
@@ -24,7 +24,7 @@ from absl import flags
from
absl
import
logging
import
tensorflow
as
tf
from
official.nlp.
bert
import
tokenization
from
official.nlp.
tools
import
tokenization
FLAGS
=
flags
.
FLAGS
...
...
official/nlp/data/create_pretraining_data_test.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/data/create_xlnet_pretraining_data.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
@@ -14,6 +14,7 @@
"""Create LM TF examples for XLNet."""
import
dataclasses
import
json
import
math
import
os
...
...
@@ -28,11 +29,10 @@ from absl import app
from
absl
import
flags
from
absl
import
logging
import
dataclasses
import
numpy
as
np
import
tensorflow
as
tf
from
official.nlp.
bert
import
tokenization
from
official.nlp.
tools
import
tokenization
special_symbols
=
{
"<unk>"
:
0
,
...
...
official/nlp/data/create_xlnet_pretraining_data_test.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/data/data_loader.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/data/data_loader_factory.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/data/data_loader_factory_test.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/data/dual_encoder_dataloader.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/data/dual_encoder_dataloader_test.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/data/pretrain_dataloader.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/data/pretrain_dataloader_test.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
official/nlp/data/pretrain_dynamic_dataloader.py
View file @
d7511194
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
2
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.
...
...
@@ -79,17 +79,29 @@ class PretrainingDynamicDataLoader(pretrain_dataloader.BertPretrainDataLoader):
def
_decode
(
self
,
record
:
tf
.
Tensor
):
"""Decodes a serialized tf.Example."""
name_to_features
=
{
'input_ids'
:
tf
.
io
.
VarLenFeature
(
tf
.
int64
),
'input_mask'
:
tf
.
io
.
VarLenFeature
(
tf
.
int64
),
'segment_ids'
:
tf
.
io
.
VarLenFeature
(
tf
.
int64
),
'masked_lm_positions'
:
tf
.
io
.
VarLenFeature
(
tf
.
int64
),
'masked_lm_ids'
:
tf
.
io
.
VarLenFeature
(
tf
.
int64
),
'masked_lm_weights'
:
tf
.
io
.
VarLenFeature
(
tf
.
float32
),
}
if
self
.
_params
.
use_v2_feature_names
:
input_ids_key
=
'input_word_ids'
segment_key
=
'input_type_ids'
name_to_features
.
update
({
input_ids_key
:
tf
.
io
.
VarLenFeature
(
tf
.
int64
),
segment_key
:
tf
.
io
.
VarLenFeature
(
tf
.
int64
),
})
else
:
input_ids_key
=
'input_ids'
segment_key
=
'segment_ids'
name_to_features
.
update
({
input_ids_key
:
tf
.
io
.
VarLenFeature
(
tf
.
int64
),
segment_key
:
tf
.
io
.
VarLenFeature
(
tf
.
int64
),
})
if
self
.
_use_next_sentence_label
:
name_to_features
[
'next_sentence_labels'
]
=
tf
.
io
.
FixedLenFeature
([
1
],
tf
.
int64
)
dynamic_keys
=
[
'
input_ids
'
,
'input_mask'
,
'
segment_
ids'
]
dynamic_keys
=
[
input_ids
_key
,
'input_mask'
,
segment_
key
]
if
self
.
_use_position_id
:
name_to_features
[
'position_ids'
]
=
tf
.
io
.
VarLenFeature
(
tf
.
int64
)
dynamic_keys
.
append
(
'position_ids'
)
...
...
@@ -102,7 +114,7 @@ class PretrainingDynamicDataLoader(pretrain_dataloader.BertPretrainDataLoader):
# sequence length dimension.
# Pad before the first non pad from the back should not be removed.
mask
=
tf
.
math
.
greater
(
tf
.
math
.
cumsum
(
example
[
'
input_ids
'
],
reverse
=
True
),
0
)
tf
.
math
.
cumsum
(
example
[
input_ids
_key
],
reverse
=
True
),
0
)
for
key
in
dynamic_keys
:
example
[
key
]
=
tf
.
boolean_mask
(
example
[
key
],
mask
)
...
...
Prev
1
…
9
10
11
12
13
14
15
16
17
…
50
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