Commit 89fd2bb1 authored by Hongkun Yu's avatar Hongkun Yu Committed by A. Unique TensorFlower
Browse files

Py3 cleanup for nlp/

PiperOrigin-RevId: 339071563
parent 4085c19a
...@@ -18,10 +18,6 @@ Source: ...@@ -18,10 +18,6 @@ Source:
https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/utils/bleu_hook.py https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/utils/bleu_hook.py
""" """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re import re
import sys import sys
import unicodedata import unicodedata
......
...@@ -14,10 +14,6 @@ ...@@ -14,10 +14,6 @@
# ============================================================================== # ==============================================================================
"""Download and preprocess WMT17 ende training and evaluation datasets.""" """Download and preprocess WMT17 ende training and evaluation datasets."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os import os
import random import random
import tarfile import tarfile
......
...@@ -47,10 +47,6 @@ Two things to note in the pipeline: ...@@ -47,10 +47,6 @@ Two things to note in the pipeline:
in the order of the examples. in the order of the examples.
""" """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os import os
from absl import logging from absl import logging
......
...@@ -14,10 +14,6 @@ ...@@ -14,10 +14,6 @@
# ============================================================================== # ==============================================================================
"""Implementation of embedding layer with shared weights.""" """Implementation of embedding layer with shared weights."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf import tensorflow as tf
......
...@@ -14,10 +14,6 @@ ...@@ -14,10 +14,6 @@
# ============================================================================== # ==============================================================================
"""Implementation of fully connected network.""" """Implementation of fully connected network."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf import tensorflow as tf
......
...@@ -22,9 +22,6 @@ Metrics: ...@@ -22,9 +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 division
from __future__ import print_function
import functools import functools
......
...@@ -14,10 +14,6 @@ ...@@ -14,10 +14,6 @@
# ============================================================================== # ==============================================================================
"""Misc for Transformer.""" """Misc for Transformer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=g-bad-import-order # pylint: disable=g-bad-import-order
from absl import flags from absl import flags
......
...@@ -14,10 +14,6 @@ ...@@ -14,10 +14,6 @@
# ============================================================================== # ==============================================================================
"""Transformer model helper methods.""" """Transformer model helper methods."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math import math
import numpy as np import numpy as np
......
...@@ -14,10 +14,6 @@ ...@@ -14,10 +14,6 @@
# ============================================================================== # ==============================================================================
"""Test Transformer model helper methods.""" """Test Transformer model helper methods."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf import tensorflow as tf
from official.nlp.transformer import model_utils from official.nlp.transformer import model_utils
......
...@@ -14,10 +14,6 @@ ...@@ -14,10 +14,6 @@
# ============================================================================== # ==============================================================================
"""Optimizer from addons and learning rate scheduler.""" """Optimizer from addons and learning rate scheduler."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf import tensorflow as tf
......
...@@ -17,9 +17,6 @@ ...@@ -17,9 +17,6 @@
Model paper: https://arxiv.org/pdf/1706.03762.pdf Model paper: https://arxiv.org/pdf/1706.03762.pdf
Transformer model code source: https://github.com/tensorflow/tensor2tensor Transformer model code source: https://github.com/tensorflow/tensor2tensor
""" """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf import tensorflow as tf
from official.nlp.modeling.layers import position_embedding from official.nlp.modeling.layers import position_embedding
......
...@@ -14,10 +14,6 @@ ...@@ -14,10 +14,6 @@
# ============================================================================== # ==============================================================================
"""Tests for layers in Transformer.""" """Tests for layers in Transformer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf import tensorflow as tf
from official.nlp.transformer import attention_layer from official.nlp.transformer import attention_layer
......
...@@ -17,9 +17,6 @@ ...@@ -17,9 +17,6 @@
See README for description of setting the training schedule and evaluating the See README for description of setting the training schedule and evaluating the
BLEU score. BLEU score.
""" """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os import os
import tempfile import tempfile
......
...@@ -14,10 +14,6 @@ ...@@ -14,10 +14,6 @@
# ============================================================================== # ==============================================================================
"""Test Transformer model.""" """Test Transformer model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os import os
import re import re
import sys import sys
......
...@@ -14,10 +14,6 @@ ...@@ -14,10 +14,6 @@
# ============================================================================== # ==============================================================================
"""Test Transformer model.""" """Test Transformer model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf import tensorflow as tf
from official.nlp.transformer import model_params from official.nlp.transformer import model_params
......
...@@ -14,10 +14,6 @@ ...@@ -14,10 +14,6 @@
# ============================================================================== # ==============================================================================
"""Translate text or files using trained transformer model.""" """Translate text or files using trained transformer model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Import libraries # Import libraries
from absl import logging from absl import logging
import numpy as np import numpy as np
......
...@@ -13,10 +13,6 @@ ...@@ -13,10 +13,6 @@
# limitations under the License. # limitations under the License.
# ============================================================================== # ==============================================================================
"""Common flags used in XLNet model.""" """Common flags used in XLNet model."""
from __future__ import absolute_import
from __future__ import division
# from __future__ import google_type_annotations
from __future__ import print_function
from absl import flags from absl import flags
......
...@@ -14,11 +14,6 @@ ...@@ -14,11 +14,6 @@
# ============================================================================== # ==============================================================================
"""Utilities used for data preparation.""" """Utilities used for data preparation."""
from __future__ import absolute_import
from __future__ import division
# from __future__ import google_type_annotations
from __future__ import print_function
import collections import collections
import json import json
import os import os
......
...@@ -13,10 +13,6 @@ ...@@ -13,10 +13,6 @@
# limitations under the License. # limitations under the License.
# ============================================================================== # ==============================================================================
"""Functions and classes related to optimization (weight updates).""" """Functions and classes related to optimization (weight updates)."""
from __future__ import absolute_import
from __future__ import division
# from __future__ import google_type_annotations
from __future__ import print_function
from absl import logging from absl import logging
import tensorflow as tf import tensorflow as tf
......
...@@ -13,9 +13,6 @@ ...@@ -13,9 +13,6 @@
# limitations under the License. # limitations under the License.
# ============================================================================== # ==============================================================================
"""Script to pre-process classification data into tfrecords.""" """Script to pre-process classification data into tfrecords."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections import collections
import csv import csv
......
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