NVIDIA / OpenSeq2Seq

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

Cache preprocessed speech features issue of filename.decode #313

Closed GabrielLin closed 5 years ago

GabrielLin commented 5 years ago

After the merge of #285 .

I run the following command: python -u run.py --config_file=example_configs/speech2text/lstm_small_1gpu.py --mode=train_eval --decoder_params/use_language_model=True --use_horovod=False --num_gpus=4 --enable_logs

The following error is shown:

File "/data1/nlp/NVIDIA-OpenSeq2Seq/open_seq2seq/data/speech2text/speech2text.py", line 339, in _parse_audio_transcript_element params=self.params

File "/data1/nlp/NVIDIA-OpenSeq2Seq/open_seq2seq/data/speech2text/speech_utils.py", line 174, in get_speech_features_from_file preprocessed_data_path = get_preprocessed_data_path(filename, params)

File "/data1/nlp/NVIDIA-OpenSeq2Seq/open_seq2seq/data/speech2text/speech_utils.py", line 89, in get_preprocessed_data_path filename = filename.decode(

AttributeError: 'str' object has no attribute 'decode'

@mvankeirsbilck

mvankeirsbilck commented 5 years ago

This is because of how the filenames are written/read from the csv file. If they're written/read as binary strings, you need to decode. If they're written/read as normal strings, you don't and get this error. It might be there's some conversion in the data loading. https://stackoverflow.com/questions/17615414/how-to-convert-binary-string-to-normal-string-in-python3

You could try something like:

    try: filename = filename.decode('ascii')  # required b/c we read filename from csv in binary mode
    except AttributeError: pass
GabrielLin commented 5 years ago

Thanks for your rapid reply. Could you please create a PR? I think if people follow the import_librivox.py and read it by default repo. The csv file is normal strings.

GabrielLin commented 5 years ago

314 . Thank you @mvankeirsbilck .