Unverified Commit 3a97b68c authored by Toby Boyd's avatar Toby Boyd Committed by GitHub
Browse files

fix lint issues. (#6855)

parent 85bdf764
...@@ -117,7 +117,7 @@ class Subtokenizer(object): ...@@ -117,7 +117,7 @@ class Subtokenizer(object):
token_counts, alphabet, target_vocab_size, threshold, min_count, token_counts, alphabet, target_vocab_size, threshold, min_count,
reserved_tokens) reserved_tokens)
tf.compat.v1.logging.info("Generated vocabulary with %d subtokens." % tf.compat.v1.logging.info("Generated vocabulary with %d subtokens." %
len(subtoken_list)) len(subtoken_list))
_save_vocab_file(vocab_file, subtoken_list) _save_vocab_file(vocab_file, subtoken_list)
return Subtokenizer(vocab_file) return Subtokenizer(vocab_file)
......
...@@ -36,6 +36,7 @@ class EmbeddingSharedWeights(tf.keras.layers.Layer): ...@@ -36,6 +36,7 @@ class EmbeddingSharedWeights(tf.keras.layers.Layer):
self.hidden_size = hidden_size self.hidden_size = hidden_size
def build(self, input_shape): def build(self, input_shape):
"""Build embedding layer."""
with tf.name_scope("embedding_and_softmax"): with tf.name_scope("embedding_and_softmax"):
# Create and initialize weights. The random normal initializer was chosen # Create and initialize weights. The random normal initializer was chosen
# arbitrarily, and works well. # arbitrarily, and works well.
......
...@@ -22,7 +22,6 @@ Metrics: ...@@ -22,7 +22,6 @@ Metrics:
- ROUGE score. Source: - ROUGE score. Source:
https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/utils/rouge.py https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/utils/rouge.py
""" """
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
from __future__ import print_function from __future__ import print_function
...@@ -150,7 +149,7 @@ class MetricLayer(tf.keras.layers.Layer): ...@@ -150,7 +149,7 @@ class MetricLayer(tf.keras.layers.Layer):
(tf.keras.metrics.Mean("accuracy"), padded_accuracy), (tf.keras.metrics.Mean("accuracy"), padded_accuracy),
(tf.keras.metrics.Mean("accuracy_top5"), padded_accuracy_top5), (tf.keras.metrics.Mean("accuracy_top5"), padded_accuracy_top5),
(tf.keras.metrics.Mean("accuracy_per_sequence"), (tf.keras.metrics.Mean("accuracy_per_sequence"),
padded_sequence_accuracy), padded_sequence_accuracy),
(tf.keras.metrics.Mean("neg_log_perplexity"), neg_log_perplexity), (tf.keras.metrics.Mean("neg_log_perplexity"), neg_log_perplexity),
] ]
super(MetricLayer, self).build(input_shape) super(MetricLayer, self).build(input_shape)
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
# 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.
# ============================================================================== # ==============================================================================
"""Optimizer from addons and learning rate scheduler. """Optimizer from addons and learning rate scheduler."""
"""
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import division from __future__ import division
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment