Skip to content

Commit a76a4a2

Browse files
committed
avoid running into end of sequence
1 parent cd8f6c3 commit a76a4a2

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/data/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def _create_dataset(self,
519519
dataset = dataset.prefetch(tf.data.AUTOTUNE)
520520

521521
# Assert the cardinality of the dataset if training
522-
if steps_per_epoch is None and is_training:
522+
if steps_per_epoch is None:
523523
batches = int(np.ceil(len(self.raw_data[partition_name][0]) / self.config['batch_size']))
524524
dataset = dataset.apply(tf.data.experimental.assert_cardinality(batches))
525525

src/utils/decoding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from utils.text import Tokenizer
1212

1313

14-
@tf.function
14+
@tf.function(reduce_retracing=True)
1515
def ctc_decode(
1616
y_pred: np.ndarray,
1717
input_length: np.ndarray,

src/utils/threading.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ def _update_statistics(self, batch_counter: defaultdict, batch_size: int) -> Non
224224
def stop(self) -> None:
225225
"""Stops the thread and waits for it to terminate."""
226226
self.running = False
227-
self.join()
227+
if self is not threading.current_thread():
228+
self.join()
228229

229230

230231
class DecodingWorker(Thread):

0 commit comments

Comments
 (0)