diff --git a/.gitignore b/.gitignore index ebe097c2a7..b34cf27262 100755 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ Session.vim .idea .vscode __pycache__ +.pytest* venv \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 84607c1876..5921cbcd9c 100755 --- a/setup.cfg +++ b/setup.cfg @@ -1,8 +1,8 @@ [flake8] ignore = E402,E701,E702,E704,E251 -max-line-length = 150 +max-line-length = 127 [pep8] ignore = E402,E701,E702,E704,E251 -max-line-length = 150 +max-line-length = 127 indent-size = 4 diff --git a/tensorflow_asr/models/streaming_transducer.py b/tensorflow_asr/models/streaming_transducer.py index 60146f4e9d..38e13a3f77 100644 --- a/tensorflow_asr/models/streaming_transducer.py +++ b/tensorflow_asr/models/streaming_transducer.py @@ -257,7 +257,7 @@ def recognize(self, signals): """ def execute(signal: tf.Tensor): features = self.speech_featurizer.tf_extract(signal) - encoded, _ = self.encoder_inference(features, self.encoder.get_initial_states()) + encoded, _ = self.encoder_inference(features, self.encoder.get_initial_state()) hypothesis = self.perform_greedy( encoded, predicted=tf.constant(self.text_featurizer.blank, dtype=tf.int32), @@ -310,10 +310,13 @@ def recognize_beam(self, signals, lm=False): """ def execute(signal: tf.Tensor): features = self.speech_featurizer.tf_extract(signal) - encoded, _ = self.encoder_inference(features, self.encoder.get_initial_states()) + encoded, _ = self.encoder_inference(features, self.encoder.get_initial_state()) hypothesis = self.perform_beam_search(encoded, lm) - prediction = tf.map_fn(lambda x: tf.strings.to_number(x, tf.int32), - tf.strings.split(hypothesis.prediction), fn_output_signature=tf.TensorSpec([], dtype=tf.int32)) + prediction = tf.map_fn( + lambda x: tf.strings.to_number(x, tf.int32), + tf.strings.split(hypothesis.prediction), + fn_output_signature=tf.TensorSpec([], dtype=tf.int32) + ) transcripts = self.text_featurizer.iextract(tf.expand_dims(prediction, axis=0)) return tf.squeeze(transcripts) # reshape from [1] to [] diff --git a/tensorflow_asr/models/transducer.py b/tensorflow_asr/models/transducer.py index bc54691b9b..175847ac09 100755 --- a/tensorflow_asr/models/transducer.py +++ b/tensorflow_asr/models/transducer.py @@ -451,8 +451,11 @@ def execute(signal: tf.Tensor): features = self.speech_featurizer.tf_extract(signal) encoded = self.encoder_inference(features) hypothesis = self.perform_beam_search(encoded, lm) - prediction = tf.map_fn(lambda x: tf.strings.to_number(x, tf.int32), - tf.strings.split(hypothesis.prediction), fn_output_signature=tf.TensorSpec([], dtype=tf.int32)) + prediction = tf.map_fn( + lambda x: tf.strings.to_number(x, tf.int32), + tf.strings.split(hypothesis.prediction), + fn_output_signature=tf.TensorSpec([], dtype=tf.int32) + ) transcripts = self.text_featurizer.iextract(tf.expand_dims(prediction, axis=0)) return tf.squeeze(transcripts) # reshape from [1] to [] diff --git a/tests/plot_learning_rate.py b/tests/plot_learning_rate.py index e44196a449..96bcbad620 100755 --- a/tests/plot_learning_rate.py +++ b/tests/plot_learning_rate.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import math import tensorflow as tf import matplotlib.pyplot as plt from tensorflow_asr.optimizers.schedules import SANSchedule, TransformerSchedule