NVIDIA / OpenSeq2Seq

Toolkit for efficient experimentation with Speech Recognition, Text2Speech and NLP
https://nvidia.github.io/OpenSeq2Seq
Apache License 2.0
1.54k stars 372 forks source link

UnboundLocalError when training with a custom dataset #495

Closed xaiguy closed 4 years ago

xaiguy commented 4 years ago

Hi there,

I'm currently tring to train an ASR model on Tuda-de (German ASR corpus) and I can't figure out how to resolve the error posted below.

I used the same pipeline (custom config_file, data in right format etc.) for other datasets and everything worked out so far. Only when I want to train on this specific dataset, I get an error. But I can't find any obvious formatting errors (no NAs, no special characters in the transcript, no incorrect file paths) and it's rather unclear to me why that specific error would be thrown. I tested reading the wav files manually and it worked.

Maybe someone had this error before and resolved it.

Cheers


*** Running evaluation on a validation set: 2019-09-05 12:13:49.663848: W tensorflow/core/framework/op_kernel.cc:1490] Unknown: UnboundLocalError: local variable 'fs' referenced before assignment Traceback (most recent call last):

File "/home/ubuntu/JupyterLab/Voice_Lab/OpenSeq2Seq/open_seq2seq/data/speech2text/speech_utils.py", line 178, in get_speech_features_from_file "on-the-fly preprocessing enforced with 'cache_features'==True")

open_seq2seq.data.speech2text.speech_utils.PreprocessOnTheFlyException: on-the-fly preprocessing enforced with 'cache_features'==True

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tensorflow/python/ops/script_ops.py", line 209, in call ret = func(*args)

File "/home/ubuntu/JupyterLab/Voice_Lab/OpenSeq2Seq/open_seq2seq/data/speech2text/speech2text.py", line 425, in _parse_audio_transcript_element params=self.params

File "/home/ubuntu/JupyterLab/Voice_Lab/OpenSeq2Seq/open_seq2seq/data/speech2text/speech_utils.py", line 188, in get_speech_features_from_file sample_freq, signal = wave.read(filename)

File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/scipy/io/wavfile.py", line 281, in read return fs, data

UnboundLocalError: local variable 'fs' referenced before assignment

xaiguy commented 4 years ago

I resolved it myself.

The error was indeed thrown due to a bunch of .wav files that could not be opened correctly. I checked them all with the scipy.io.wave reader and removed the ones that caused the error.