coqui-ai / STT

🐸STT - The deep learning toolkit for Speech-to-Text. Training and deploying STT models has never been so easy.
https://coqui.ai
Mozilla Public License 2.0
2.27k stars 275 forks source link

Bug: Importer `import_librivox.py` can't render absolute path of WAV files in CSV #2349

Open RobinE89 opened 1 year ago

RobinE89 commented 1 year ago

Hey,

(I don't know if this applies to all importers - I noticed it with the librivox - importer) if you define the basepath eg with "own_projects", the importer writes the filename like that: own_project/LibriSpeech/ dev-clean-wav/7850/73752/0000/7850-73752-0000.wav and place the csv in the following folder: own_project/LibriSpeech/

if you then want to train that set and define the train path as follows: --train_files own_project/LibriSpeech/librivox-train-clean-100.csv

...it will fail because: own_project/LibriSpeech/ own_project/LibriSpeech/ dev-clean-wav/7850/73752/0000/7850-73752-0000.wav not found.

"coqui_stt_training.train" inserts the path of the csv file in front of the file name. That makes sense, but then the path from the importer is wrong. trifle, but I still think it's not wanted?!

best regards

wasertech commented 1 year ago

--relative is set to False by default. https://github.com/coqui-ai/STT/blob/a694187be4817870e53f5e14b24e16b57dfaa581/bin/import_librivox.py#L193-L197 So it is using the absolute path of the wav files in the csv. https://github.com/coqui-ai/STT/blob/a694187be4817870e53f5e14b24e16b57dfaa581/bin/import_librivox.py#L126-L144 https://github.com/coqui-ai/STT/blob/a694187be4817870e53f5e14b24e16b57dfaa581/bin/import_librivox.py#L152-L155

The real issue is with this line. https://github.com/coqui-ai/STT/blob/a694187be4817870e53f5e14b24e16b57dfaa581/bin/import_librivox.py#L144 Since dest_dir is a Path object, https://github.com/coqui-ai/STT/blob/a694187be4817870e53f5e14b24e16b57dfaa581/bin/import_librivox.py#L91-L93 it should really be

files.append(wav_file.as_posix())
wasertech commented 1 year ago

it should really be files.append(wav_file.as_posix())

@RobinE89 can you make the changes locally and test if it works?

I'm starting to think that I've just broke compatibility with windows without even solving anything because str(Path()) should work as expected on all platforms...

https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.as_posix

Anyways you should probably set --realtive to True in all cases.