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
c90f8b16
Commit
c90f8b16
authored
Feb 01, 2021
by
Rajagopal Ananthanarayanan
Committed by
A. Unique TensorFlower
Feb 01, 2021
Browse files
Internal change
PiperOrigin-RevId: 355088475
parent
790de575
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
official/nlp/data/pretrain_dataloader.py
official/nlp/data/pretrain_dataloader.py
+5
-2
No files found.
official/nlp/data/pretrain_dataloader.py
View file @
c90f8b16
...
@@ -61,8 +61,7 @@ class BertPretrainDataLoader(data_loader.DataLoader):
...
@@ -61,8 +61,7 @@ class BertPretrainDataLoader(data_loader.DataLoader):
self
.
_use_next_sentence_label
=
params
.
use_next_sentence_label
self
.
_use_next_sentence_label
=
params
.
use_next_sentence_label
self
.
_use_position_id
=
params
.
use_position_id
self
.
_use_position_id
=
params
.
use_position_id
def
_decode
(
self
,
record
:
tf
.
Tensor
):
def
_name_to_features
(
self
):
"""Decodes a serialized tf.Example."""
name_to_features
=
{
name_to_features
=
{
'input_mask'
:
'input_mask'
:
tf
.
io
.
FixedLenFeature
([
self
.
_seq_length
],
tf
.
int64
),
tf
.
io
.
FixedLenFeature
([
self
.
_seq_length
],
tf
.
int64
),
...
@@ -89,7 +88,11 @@ class BertPretrainDataLoader(data_loader.DataLoader):
...
@@ -89,7 +88,11 @@ class BertPretrainDataLoader(data_loader.DataLoader):
if
self
.
_use_position_id
:
if
self
.
_use_position_id
:
name_to_features
[
'position_ids'
]
=
tf
.
io
.
FixedLenFeature
(
name_to_features
[
'position_ids'
]
=
tf
.
io
.
FixedLenFeature
(
[
self
.
_seq_length
],
tf
.
int64
)
[
self
.
_seq_length
],
tf
.
int64
)
return
name_to_features
def
_decode
(
self
,
record
:
tf
.
Tensor
):
"""Decodes a serialized tf.Example."""
name_to_features
=
self
.
_name_to_features
()
example
=
tf
.
io
.
parse_single_example
(
record
,
name_to_features
)
example
=
tf
.
io
.
parse_single_example
(
record
,
name_to_features
)
# tf.Example only supports tf.int64, but the TPU only supports tf.int32.
# tf.Example only supports tf.int64, but the TPU only supports tf.int32.
...
...
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