From 24bcdeb3d6befa7259159917205f0b7e78f5ebec Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Wed, 28 Aug 2019 10:55:33 +0200 Subject: [PATCH] Switch from deprecated tfv1.app to absl-py --- DeepSpeech.py | 3 ++- evaluate.py | 4 ++-- requirements.txt | 1 + util/flags.py | 9 +++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/DeepSpeech.py b/DeepSpeech.py index 758e4670..f2f5ebcd 100755 --- a/DeepSpeech.py +++ b/DeepSpeech.py @@ -8,6 +8,7 @@ import sys LOG_LEVEL_INDEX = sys.argv.index('--log_level') + 1 if '--log_level' in sys.argv else 0 os.environ['TF_CPP_MIN_LOG_LEVEL'] = sys.argv[LOG_LEVEL_INDEX] if 0 < LOG_LEVEL_INDEX < len(sys.argv) else '3' +import absl.app import numpy as np import progressbar import shutil @@ -891,4 +892,4 @@ def main(_): if __name__ == '__main__': create_flags() - tfv1.app.run(main) + absl.app.run(main) diff --git a/evaluate.py b/evaluate.py index 95289e61..1f672a06 100755 --- a/evaluate.py +++ b/evaluate.py @@ -7,6 +7,7 @@ import json from multiprocessing import cpu_count +import absl.app import numpy as np import progressbar import tensorflow as tf @@ -167,5 +168,4 @@ def main(_): if __name__ == '__main__': create_flags() - tf.app.flags.DEFINE_string('test_output_file', '', 'path to a file to save all src/decoded/distance/loss tuples') - tfv1.app.run(main) + absl.app.run(main) diff --git a/requirements.txt b/requirements.txt index e07cb9cc..eddcb6f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,7 @@ pandas six pyxdg attrdict +absl-py # Requirements for building native_client files setuptools diff --git a/util/flags.py b/util/flags.py index f55e14d8..e1eb1788 100644 --- a/util/flags.py +++ b/util/flags.py @@ -1,16 +1,15 @@ from __future__ import absolute_import, division, print_function -import tensorflow as tf - import os +import absl.flags -FLAGS = tf.app.flags.FLAGS +FLAGS = absl.flags.FLAGS def create_flags(): # Importer # ======== - f = tf.app.flags + f = absl.flags f.DEFINE_string('train_files', '', 'comma separated list of files specifying the dataset used for training. Multiple files will get merged. If empty, training will not be run.') f.DEFINE_string('dev_files', '', 'comma separated list of files specifying the dataset used for validation. Multiple files will get merged. If empty, validation will not be run.') @@ -89,6 +88,8 @@ def create_flags(): f.DEFINE_string('summary_dir', '', 'target directory for TensorBoard summaries - defaults to directory "deepspeech/summaries" within user\'s data home specified by the XDG Base Directory Specification') + f.DEFINE_string('test_output_file', '', 'path to a file to save all src/decoded/distance/loss tuples generated during a test epoch') + # Geometry f.DEFINE_integer('n_hidden', 2048, 'layer width to use when initialising layers')