WER calculation seems to be a computational bottleneck
I'm running the run-ted.sh script on amazon's p2.16xlarge instance (i.e. 16 K80 Tesla GPUs), and whenever I run the default settings, the GPUs become inactive for periods of 10-30 minutes, or even longer, during which time on single cpu core seems to be doing a lot of work (htop shows 100% mem. for this one core). Investigating the code a bit (and putting in lots print statements) seems to indicate that it is the WER calculation, more specifically, the 'calculate_report' helper function, which creates this weird behaviour. I commented out the calculate_report() function call in the training() function, and this issues disappears, i.e. GPU are back to being active, no "sleeping" periods. More specifically, the issue seems to be with the helper function 'correction' (which assuming corrects the spelling of the model output sequence) that is called from inside "calculate_report", but I'm running an experiment to verify this. Is this a common issues with others as well, and is there a built in way of getting WER reports for training and validation epochs without this GPU inactivity periods, which SIGNIFICANTLY slown down training (3 days for 3 epochs on TED, on 16 GPUs does not seem right)? cheers
We agree it's a huge computational bottleneck.
What we tend to do now is computer WER only at the end and monitor runs using the loss. One can do this, fore example, by setting the command line parameters
python -u DeepSpeech.py \
...
--display_step 0 \
--validation_step 1 \
...
Currently we're working on integrating the language model using C++ into the CTC decoder of TensorFlow which should speed things up quite a bit.
Thanks for the quick reply! I'll try it out, and I'll also let you know if leaving out the spelling correction does the trick (it almost looks that way...).
cheers
just an update: i commented out the spelling correction part in the calculate_report function, and its speeding up training considerably (epochs are now taking 1.5 hrs as opposed to 1-2 days). so now training can be done, however the results printed to the screen w.r.t the WER are now obvisously a lot worse than they were before, since there is no reduction of made up tokens (results of misspelling by the model) through the spelling corrector, and its much harder to get words right. is the spelling corrector part of the native client build used for inference by default?
tl;dr: commenting out the spelling correction speeds up training significantly, but makes it harder to track the 'true' progress of the model w.r.t the WER. my guess is this 'hack' does not impact on the final model's performance, assuming that the spelling corrector is part of the native client build for inference.
@SebastianScherer88 A new language model integration should land within the next week or so. This will significantly improve things.
@kdavis-mozilla any updates in Language model integration? Also any comments on this https://github.com/timediv/tensorflow-with-kenlm It has integrated kenlm language model into the ctc beam search decoder. Can we use this variant of tensorflow on Deepspeech.
@saurabhvyas We have a PR that's about to land[1] doing the integration too :-)
Can the trained model be exported without compute WER report? I am training the Chinese model and it takes a long to test and export the model after training process.
You could set display_step to 0, test to False, and export_dir to your desired directory.
Thank you!I have tried it. And I have found that since the alphabet size is large(more than 6000), the ctc function will cost a long time. I try to use the warpctc function in tensorflow-warpctc, but there are some issues.
We've not tried a Chinese model yet.
One thing that might need to be done is to introduce an embedding model that embeds the 6000 dimensional vectors in to a smaller dimensional space and lets the engine calculate on this smaller dimensional space, then un-embeds to the full 6000 dimensional space when done.
Do you mean that transform the one hot vector(dimension is 6000) to a new word vector(maybe dimension is 300) when calculating?
Yes, using an embedding matrix.
However, before going through all the effort. What hardware are you on?
@jackHuanghello 加个联系方式交流一下 mozilla这个 deepspeech在中文识别上的训练问题?我的QQ: 502002801
@jackHuanghello 方便交流一下在中文识别上的应用吗?qq:2385114637,谢谢
We not computer WER only at trainining's end.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.