Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
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
60 additions
and
52 deletions
+60
-52
official/nlp/modeling/networks/span_labeling.py
official/nlp/modeling/networks/span_labeling.py
+2
-2
official/nlp/modeling/networks/span_labeling_test.py
official/nlp/modeling/networks/span_labeling_test.py
+2
-2
official/nlp/modeling/networks/xlnet_base.py
official/nlp/modeling/networks/xlnet_base.py
+2
-3
official/nlp/modeling/networks/xlnet_base_test.py
official/nlp/modeling/networks/xlnet_base_test.py
+2
-5
official/nlp/modeling/ops/__init__.py
official/nlp/modeling/ops/__init__.py
+1
-1
official/nlp/modeling/ops/beam_search.py
official/nlp/modeling/ops/beam_search.py
+7
-3
official/nlp/modeling/ops/beam_search_test.py
official/nlp/modeling/ops/beam_search_test.py
+2
-2
official/nlp/modeling/ops/decoding_module.py
official/nlp/modeling/ops/decoding_module.py
+2
-2
official/nlp/modeling/ops/decoding_module_test.py
official/nlp/modeling/ops/decoding_module_test.py
+2
-2
official/nlp/modeling/ops/sampling_module.py
official/nlp/modeling/ops/sampling_module.py
+5
-6
official/nlp/modeling/ops/segment_extractor.py
official/nlp/modeling/ops/segment_extractor.py
+1
-3
official/nlp/modeling/ops/segment_extractor_test.py
official/nlp/modeling/ops/segment_extractor_test.py
+1
-3
official/nlp/nhnet/__init__.py
official/nlp/nhnet/__init__.py
+14
-0
official/nlp/nhnet/configs.py
official/nlp/nhnet/configs.py
+2
-3
official/nlp/nhnet/configs_test.py
official/nlp/nhnet/configs_test.py
+2
-2
official/nlp/nhnet/decoder.py
official/nlp/nhnet/decoder.py
+2
-2
official/nlp/nhnet/decoder_test.py
official/nlp/nhnet/decoder_test.py
+2
-2
official/nlp/nhnet/evaluation.py
official/nlp/nhnet/evaluation.py
+2
-3
official/nlp/nhnet/input_pipeline.py
official/nlp/nhnet/input_pipeline.py
+2
-2
official/nlp/nhnet/models.py
official/nlp/nhnet/models.py
+5
-4
No files found.
official/nlp/modeling/networks/span_labeling.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Span labeling network."""
"""Span labeling network."""
# pylint: disable=g-classes-have-attributes
# pylint: disable=g-classes-have-attributes
import
collections
import
collections
...
...
official/nlp/modeling/networks/span_labeling_test.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Tests for span_labeling network."""
"""Tests for span_labeling network."""
import
numpy
as
np
import
numpy
as
np
import
tensorflow
as
tf
import
tensorflow
as
tf
...
...
official/nlp/modeling/networks/xlnet_base.py
View file @
bb124157
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,7 @@
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Keras-based XLNet Model."""
"""Keras-based XLNet Model."""
from
absl
import
logging
from
absl
import
logging
...
...
official/nlp/modeling/networks/xlnet_base_test.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,11 +11,8 @@
...
@@ -11,11 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
"""Tests for Keras based XLNet model."""
import
numpy
as
np
import
numpy
as
np
import
tensorflow
as
tf
import
tensorflow
as
tf
...
...
official/nlp/modeling/ops/__init__.py
View file @
bb124157
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Ops package definition."""
"""Ops package definition."""
from
official.nlp.modeling.ops.beam_search
import
sequence_beam_search
from
official.nlp.modeling.ops.beam_search
import
sequence_beam_search
from
official.nlp.modeling.ops.segment_extractor
import
get_next_sentence_labels
from
official.nlp.modeling.ops.segment_extractor
import
get_next_sentence_labels
...
...
official/nlp/modeling/ops/beam_search.py
View file @
bb124157
# Copyright 201
8
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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Beam search to find the translated sequence with the highest probability."""
"""Beam search to find the translated sequence with the highest probability."""
import
numpy
as
np
import
numpy
as
np
...
@@ -514,7 +514,11 @@ class SequenceBeamSearch(tf.Module):
...
@@ -514,7 +514,11 @@ class SequenceBeamSearch(tf.Module):
max_length_norm
=
_length_normalization
(
max_length_norm
=
_length_normalization
(
self
.
alpha
,
self
.
max_decode_length
,
dtype
=
self
.
dtype
)
self
.
alpha
,
self
.
max_decode_length
,
dtype
=
self
.
dtype
)
# Get the best possible scores from alive sequences.
# Get the best possible scores from alive sequences.
best_alive_scores
=
alive_log_probs
[:,
0
]
/
max_length_norm
# This tf.slice/tf.squeeze is equivalent to alive_log_probs[:, 0] which
# emits a tf.strided_slice. tf.slice is easier to reason about as we aren't
# actually taking a non trivial stride.
best_alive_scores
=
tf
.
squeeze
(
tf
.
slice
(
alive_log_probs
,
[
0
,
0
],
[
-
1
,
1
]),
axis
=
1
)
/
max_length_norm
# Compute worst score in finished sequences for each batch element
# Compute worst score in finished sequences for each batch element
finished_scores
*=
tf
.
cast
(
finished_flags
,
finished_scores
*=
tf
.
cast
(
finished_flags
,
...
...
official/nlp/modeling/ops/beam_search_test.py
View file @
bb124157
# Copyright 201
8
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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Test beam search helper methods."""
"""Test beam search helper methods."""
from
absl.testing
import
parameterized
from
absl.testing
import
parameterized
...
...
official/nlp/modeling/ops/decoding_module.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Base class for Decoding Strategies (beam_search, top_k, top_p and greedy)."""
"""Base class for Decoding Strategies (beam_search, top_k, top_p and greedy)."""
import
abc
import
abc
...
...
official/nlp/modeling/ops/decoding_module_test.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Test decoding utility methods."""
"""Test decoding utility methods."""
import
abc
import
abc
...
...
official/nlp/modeling/ops/sampling_module.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Sampling module for top_k, top_p and greedy decoding."""
"""Sampling module for top_k, top_p and greedy decoding."""
import
abc
import
abc
...
@@ -145,7 +145,7 @@ def set_tensor_by_indices_to_value(input_tensor, indices, value):
...
@@ -145,7 +145,7 @@ def set_tensor_by_indices_to_value(input_tensor, indices, value):
class
SamplingModule
(
decoding_module
.
DecodingModule
,
metaclass
=
abc
.
ABCMeta
):
class
SamplingModule
(
decoding_module
.
DecodingModule
,
metaclass
=
abc
.
ABCMeta
):
"""Implementation for sampling stratgies (go/decoding-tf-nlp)."""
"""Implementation for sampling strat
e
gies (go/decoding-tf-nlp)."""
def
__init__
(
self
,
def
__init__
(
self
,
symbols_to_logits_fn
,
symbols_to_logits_fn
,
...
@@ -166,8 +166,7 @@ class SamplingModule(decoding_module.DecodingModule, metaclass=abc.ABCMeta):
...
@@ -166,8 +166,7 @@ class SamplingModule(decoding_module.DecodingModule, metaclass=abc.ABCMeta):
self
.
padded_decode
=
padded_decode
self
.
padded_decode
=
padded_decode
self
.
dtype
=
tf
.
as_dtype
(
dtype
)
self
.
dtype
=
tf
.
as_dtype
(
dtype
)
self
.
vocab_size
=
tf
.
convert_to_tensor
(
vocab_size
,
dtype
=
tf
.
int32
)
self
.
vocab_size
=
tf
.
convert_to_tensor
(
vocab_size
,
dtype
=
tf
.
int32
)
self
.
max_decode_length
=
tf
.
convert_to_tensor
(
max_decode_length
,
self
.
max_decode_length
=
max_decode_length
dtype
=
tf
.
int32
)
self
.
top_k
=
tf
.
convert_to_tensor
(
top_k
,
dtype
=
tf
.
int32
)
self
.
top_k
=
tf
.
convert_to_tensor
(
top_k
,
dtype
=
tf
.
int32
)
self
.
top_p
=
tf
.
convert_to_tensor
(
top_p
,
dtype
=
tf
.
float32
)
self
.
top_p
=
tf
.
convert_to_tensor
(
top_p
,
dtype
=
tf
.
float32
)
self
.
sample_temperature
=
tf
.
convert_to_tensor
(
sample_temperature
,
self
.
sample_temperature
=
tf
.
convert_to_tensor
(
sample_temperature
,
...
@@ -250,7 +249,7 @@ class SamplingModule(decoding_module.DecodingModule, metaclass=abc.ABCMeta):
...
@@ -250,7 +249,7 @@ class SamplingModule(decoding_module.DecodingModule, metaclass=abc.ABCMeta):
if
inner_value
.
dtype
!=
self
.
dtype
:
if
inner_value
.
dtype
!=
self
.
dtype
:
raise
TypeError
(
raise
TypeError
(
"initial_cache element for key '%s' has dtype %s that does not "
"initial_cache element for key '%s' has dtype %s that does not "
"match
SequenceBeamSearch
's dtype of %s. Value: %s"
%
"match
sampling_module
's dtype of %s. Value: %s"
%
(
key
,
value
.
dtype
.
name
,
self
.
dtype
.
name
,
inner_value
))
(
key
,
value
.
dtype
.
name
,
self
.
dtype
.
name
,
inner_value
))
# Current loop index (starts at 0)
# Current loop index (starts at 0)
...
...
official/nlp/modeling/ops/segment_extractor.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,9 +11,7 @@
...
@@ -11,9 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""Module for extracting segments from sentences in documents."""
"""Module for extracting segments from sentences in documents."""
import
tensorflow
as
tf
import
tensorflow
as
tf
...
...
official/nlp/modeling/ops/segment_extractor_test.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,10 +11,8 @@
...
@@ -11,10 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# encoding=utf-8
# encoding=utf-8
# Lint as: python3
"""Tests for sentence prediction labels."""
"""Tests for sentence prediction labels."""
import
functools
import
functools
...
...
official/nlp/nhnet/__init__.py
View file @
bb124157
# 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.
official/nlp/nhnet/configs.py
View file @
bb124157
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,7 @@
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Common NHNet/Bert2Bert configuration."""
"""Common NHNet/Bert2Bert configuration."""
from
typing
import
List
,
Text
from
typing
import
List
,
Text
...
...
official/nlp/nhnet/configs_test.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Tests for configs."""
"""Tests for configs."""
import
tensorflow
as
tf
import
tensorflow
as
tf
...
...
official/nlp/nhnet/decoder.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Transformer decoder that mimics a BERT encoder, to load BERT checkpoints."""
"""Transformer decoder that mimics a BERT encoder, to load BERT checkpoints."""
import
tensorflow
as
tf
import
tensorflow
as
tf
...
...
official/nlp/nhnet/decoder_test.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Tests for nlp.nhnet.decoder."""
"""Tests for nlp.nhnet.decoder."""
import
numpy
as
np
import
numpy
as
np
...
...
official/nlp/nhnet/evaluation.py
View file @
bb124157
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,7 @@
...
@@ -12,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Evaluation for Bert2Bert."""
"""Evaluation for Bert2Bert."""
import
os
import
os
...
...
official/nlp/nhnet/input_pipeline.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Input pipelines."""
"""Input pipelines."""
import
tensorflow
as
tf
import
tensorflow
as
tf
...
...
official/nlp/nhnet/models.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");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,21 +11,22 @@
...
@@ -11,21 +11,22 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""tf.keras Models for NHNet."""
"""tf.keras Models for NHNet."""
from
typing
import
Optional
,
Text
from
absl
import
logging
from
absl
import
logging
import
gin
import
gin
import
tensorflow
as
tf
import
tensorflow
as
tf
from
typing
import
Optional
,
Text
from
official.modeling
import
tf_utils
from
official.modeling
import
tf_utils
from
official.modeling.hyperparams
import
params_dict
from
official.modeling.hyperparams
import
params_dict
from
official.nlp.modeling
import
networks
from
official.nlp.modeling
import
networks
from
official.nlp.modeling.layers
import
multi_channel_attention
from
official.nlp.modeling.layers
import
multi_channel_attention
from
official.nlp.modeling.ops
import
beam_search
from
official.nlp.nhnet
import
configs
from
official.nlp.nhnet
import
configs
from
official.nlp.nhnet
import
decoder
from
official.nlp.nhnet
import
decoder
from
official.nlp.nhnet
import
utils
from
official.nlp.nhnet
import
utils
from
official.nlp.modeling.ops
import
beam_search
def
embedding_linear
(
embedding_matrix
,
x
):
def
embedding_linear
(
embedding_matrix
,
x
):
...
...
Prev
1
…
6
7
8
9
10
11
12
13
14
…
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