From d979d9f11a767a0c6131defbce28b8f7ba966a37 Mon Sep 17 00:00:00 2001 From: Afroz Mohiuddin Date: Thu, 21 Nov 2019 20:53:30 -0800 Subject: [PATCH] pip installing tensorflow serving seems to be uninstalling the installed version of tensorflow (1.15.0) and replacing with 2.0, leading to errors of missing contrib -- so install a pinned version. Make an error in all_problems.py log earlier. Reverting the earlier change about tf flags not being shipped with TF, because of this TF 2.0 subterfuge. PiperOrigin-RevId: 281893644 --- oss_scripts/oss_integration_test.sh | 2 +- setup.py | 2 +- tensor2tensor/data_generators/all_problems.py | 4 ++-- tensor2tensor/data_generators/audio.py | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/oss_scripts/oss_integration_test.sh b/oss_scripts/oss_integration_test.sh index f5bd63e3d..46ad0fe06 100755 --- a/oss_scripts/oss_integration_test.sh +++ b/oss_scripts/oss_integration_test.sh @@ -40,7 +40,7 @@ then sleep 10 # Query - pip install tensorflow-serving-api + pip install tensorflow-serving-api=="$TF_VERSION" t2t-query-server \ --server=localhost:$server_port \ --servable_name=$model_name \ diff --git a/setup.py b/setup.py index 3248053c7..de1a41645 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,6 @@ 'tensor2tensor/bin/t2t-translate-all', ], install_requires=[ - 'absl-py', 'bz2file', 'dopamine-rl', 'flask', @@ -65,6 +64,7 @@ '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/all_problems.py b/tensor2tensor/data_generators/all_problems.py index 3efdc9cd3..f39addd71 100644 --- a/tensor2tensor/data_generators/all_problems.py +++ b/tensor2tensor/data_generators/all_problems.py @@ -126,11 +126,11 @@ def _handle_errors(errors): print(err_msg.format(num_missing=len(errors))) for module, err in errors: err_str = str(err) + if log_all: + print("Did not import module: %s; Cause: %s" % (module, err_str)) if not _is_import_err_msg(err_str, module): print("From module %s" % module) raise err - if log_all: - print("Did not import module: %s; Cause: %s" % (module, err_str)) def import_modules(modules): diff --git a/tensor2tensor/data_generators/audio.py b/tensor2tensor/data_generators/audio.py index 7a5d5d64f..4f7a65a14 100644 --- a/tensor2tensor/data_generators/audio.py +++ b/tensor2tensor/data_generators/audio.py @@ -22,9 +22,10 @@ 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", "",