From 313fdfcf94062280ebde5902a0dd771431dd5c47 Mon Sep 17 00:00:00 2001 From: Afroz Mohiuddin Date: Fri, 22 Nov 2019 15:39:47 -0800 Subject: [PATCH] Move from tf flags to absl flags, since they seem to be gone in tf 1.15 NOTE: This is only for libraries (and not binaries) in data_generators/ Also bump up version to 1.15.1 Also add a description to show on PyPI PiperOrigin-RevId: 282056584 --- setup.py | 12 ++++++++++-- tensor2tensor/data_generators/audio.py | 3 +-- tensor2tensor/data_generators/dialog_personachat.py | 2 -- tensor2tensor/data_generators/tokenizer_test.py | 1 - tensor2tensor/data_generators/translate.py | 2 -- tensor2tensor/data_generators/translate_encs.py | 3 --- tensor2tensor/data_generators/translate_enfr.py | 3 --- tensor2tensor/data_generators/translate_enzh.py | 1 - tensor2tensor/data_generators/video_utils.py | 6 +++--- tensor2tensor/data_generators/wiki_revision.py | 2 +- tensor2tensor/data_generators/wsj_parsing.py | 5 +++-- 11 files changed, 18 insertions(+), 22 deletions(-) diff --git a/setup.py b/setup.py index de1a41645..0c6df6f73 100644 --- a/setup.py +++ b/setup.py @@ -5,8 +5,16 @@ setup( name='tensor2tensor', - version='1.15.0', + version='1.15.1', description='Tensor2Tensor', + long_description=( + 'Tensor2Tensor, or T2T for short, is a library of ' + 'deep learning models and datasets designed to make deep ' + 'learning more accessible and accelerate ML research. ' + 'T2T was developed by researchers and engineers in the Google ' + 'Brain team and a community of users. It is now in maintenance ' + 'mode -- we keep it running and welcome bug-fixes, but encourage ' + 'users to use the successor library Trax.'), author='Google Inc.', author_email='no-reply@google.com', url='http://github.com/tensorflow/tensor2tensor', @@ -33,6 +41,7 @@ 'tensor2tensor/bin/t2t-translate-all', ], install_requires=[ + 'absl-py', 'bz2file', 'dopamine-rl', 'flask', @@ -64,7 +73,6 @@ 'tensorflow': ['tensorflow>=1.15.0'], 'tensorflow-hub': ['tensorflow-hub>=0.1.1'], 'tests': [ - 'absl-py', # Needed to fix a Travis pytest error. # https://github.com/Julian/jsonschema/issues/449#issuecomment-411406525 'attrs>=17.4.0', diff --git a/tensor2tensor/data_generators/audio.py b/tensor2tensor/data_generators/audio.py index 4f7a65a14..7a5d5d64f 100644 --- a/tensor2tensor/data_generators/audio.py +++ b/tensor2tensor/data_generators/audio.py @@ -22,10 +22,9 @@ import subprocess import tarfile import wave - +from absl import flags import tensorflow as tf -flags = tf.flags FLAGS = flags.FLAGS flags.DEFINE_string("timit_paths", "", diff --git a/tensor2tensor/data_generators/dialog_personachat.py b/tensor2tensor/data_generators/dialog_personachat.py index 0d848772c..ed085badc 100644 --- a/tensor2tensor/data_generators/dialog_personachat.py +++ b/tensor2tensor/data_generators/dialog_personachat.py @@ -27,9 +27,7 @@ from tensor2tensor.data_generators import dialog_abstract from tensor2tensor.data_generators import text_encoder from tensor2tensor.utils import registry -import tensorflow as tf -FLAGS = tf.flags.FLAGS # End-of-sentence marker. EOS = text_encoder.EOS_ID diff --git a/tensor2tensor/data_generators/tokenizer_test.py b/tensor2tensor/data_generators/tokenizer_test.py index 932529d90..a5bc99657 100644 --- a/tensor2tensor/data_generators/tokenizer_test.py +++ b/tensor2tensor/data_generators/tokenizer_test.py @@ -27,7 +27,6 @@ from tensor2tensor.data_generators import tokenizer import tensorflow as tf -FLAGS = tf.flags.FLAGS pkg_dir, _ = os.path.split(__file__) _TESTDATA = os.path.join(pkg_dir, "test_data") diff --git a/tensor2tensor/data_generators/translate.py b/tensor2tensor/data_generators/translate.py index b74c61ea5..8ac2f2575 100644 --- a/tensor2tensor/data_generators/translate.py +++ b/tensor2tensor/data_generators/translate.py @@ -34,8 +34,6 @@ import tensorflow as tf import tf_slim as slim -FLAGS = tf.flags.FLAGS - class TranslateProblem(text_problems.Text2TextProblem): """Base class for translation problems.""" diff --git a/tensor2tensor/data_generators/translate_encs.py b/tensor2tensor/data_generators/translate_encs.py index 5fd7a321b..7bd0fffc0 100644 --- a/tensor2tensor/data_generators/translate_encs.py +++ b/tensor2tensor/data_generators/translate_encs.py @@ -24,9 +24,6 @@ from tensor2tensor.data_generators import translate from tensor2tensor.utils import registry -import tensorflow as tf - -FLAGS = tf.flags.FLAGS # End-of-sentence marker. EOS = text_encoder.EOS_ID diff --git a/tensor2tensor/data_generators/translate_enfr.py b/tensor2tensor/data_generators/translate_enfr.py index 4484b5c4e..81fd5e4b1 100644 --- a/tensor2tensor/data_generators/translate_enfr.py +++ b/tensor2tensor/data_generators/translate_enfr.py @@ -28,9 +28,6 @@ from tensor2tensor.data_generators import wiki_lm from tensor2tensor.utils import registry -import tensorflow as tf - -FLAGS = tf.flags.FLAGS # End-of-sentence marker. EOS = text_encoder.EOS_ID diff --git a/tensor2tensor/data_generators/translate_enzh.py b/tensor2tensor/data_generators/translate_enzh.py index e5ed9cddb..c3a7370f8 100644 --- a/tensor2tensor/data_generators/translate_enzh.py +++ b/tensor2tensor/data_generators/translate_enzh.py @@ -29,7 +29,6 @@ import tensorflow as tf -FLAGS = tf.flags.FLAGS # End-of-sentence marker. EOS = text_encoder.EOS_ID diff --git a/tensor2tensor/data_generators/video_utils.py b/tensor2tensor/data_generators/video_utils.py index 98683c0e6..4d3cec63c 100644 --- a/tensor2tensor/data_generators/video_utils.py +++ b/tensor2tensor/data_generators/video_utils.py @@ -21,9 +21,10 @@ import functools import os + +from absl import flags import numpy as np import six - from tensor2tensor.data_generators import generator_utils from tensor2tensor.data_generators import image_utils from tensor2tensor.data_generators import problem @@ -33,11 +34,10 @@ from tensor2tensor.layers import modalities from tensor2tensor.utils import metrics from tensor2tensor.utils import video_metrics - import tensorflow as tf import tf_slim as slim -flags = tf.flags + FLAGS = flags.FLAGS flags.DEFINE_bool( diff --git a/tensor2tensor/data_generators/wiki_revision.py b/tensor2tensor/data_generators/wiki_revision.py index 089c941c1..f41da7556 100644 --- a/tensor2tensor/data_generators/wiki_revision.py +++ b/tensor2tensor/data_generators/wiki_revision.py @@ -31,6 +31,7 @@ import math import random +from absl import flags from tensor2tensor.data_generators import generator_utils from tensor2tensor.data_generators import text_encoder from tensor2tensor.data_generators import text_problems @@ -40,7 +41,6 @@ import tensorflow as tf -flags = tf.flags FLAGS = flags.FLAGS flags.DEFINE_integer("wiki_revision_num_train_shards", 50, diff --git a/tensor2tensor/data_generators/wsj_parsing.py b/tensor2tensor/data_generators/wsj_parsing.py index ae42e73d2..40225e43b 100644 --- a/tensor2tensor/data_generators/wsj_parsing.py +++ b/tensor2tensor/data_generators/wsj_parsing.py @@ -21,15 +21,16 @@ import os +from absl import flags from tensor2tensor.data_generators import problem from tensor2tensor.data_generators import text_problems from tensor2tensor.utils import registry import tensorflow as tf -tf.flags.DEFINE_string("parsing_path", "", "Path to parsing files in tmp_dir.") +flags.DEFINE_string("parsing_path", "", "Path to parsing files in tmp_dir.") -FLAGS = tf.flags.FLAGS +FLAGS = flags.FLAGS @registry.register_problem