Adding New Models from Huggingface
This documentation applies to the STT speech recognition project https://github.com/jianchang512/stt.
Starting from version 0.0.94, it is possible to add models from huggingface.co that are compatible with faster-whisper/ctranslate2, such as language-specific models, to compensate for the limitations of general-purpose models.
How to Add
Upgrade to version 0.0.94.
Ensure you have access to the internet via a proxy (commonly referred to as "scientific internet access") and know what a proxy and proxy port are. If this condition is not met, do not proceed, as both accessing the huggingface.co website and downloading models require proxy access.
Search for the model you want to use at https://huggingface.co/models. Note that the model must be compatible with faster-whisper/ctranslate2; otherwise, it will not work.
For example, I found this model: https://huggingface.co/zh-plus/faster-whisper-large-v2-japanese-5k-steps.
Converted from clu-ling/whisper-large-v2-japanese-5k-steps using CTranslate2.
Since it is declared as converted using ctranslate2, it can be used.
As shown in the image above, click to copy the model ID. Then, open the
set.ini
file in the software directory, find the line starting withmodel_list=
, add an English comma at the end, and paste the copied ID. Save the changes.Open the software, enter the proxy address, select the model name you just pasted from the model list, and click "Start."
If you are using v2ray-type software, the default proxy address is
http://127.0.0.1:10809
. If you are using clash-type software, the default proxy address ishttp://127.0.0.1:7890
.Note: The language of the video must match the language supported by the model you added. If you select a Japanese model but use a Chinese video, you will not get the expected results.
After starting the process, during the subtitle recognition phase, if the model is not found locally, it will automatically connect to huggingface.co to download. Depending on your proxy, this may take a few minutes to several tens of minutes. Please wait patiently.
As long as no red error messages appear, the download is in progress. If red error messages appear, they are usually due to proxy issues, such as slow or unstable proxy connections. Error messages often include
Connection to huggingface.co timed out
or a string of numbers like46573454354
indicating incomplete data.Note: If deploying from source code, even if there is a network error, it may only show errors like
No such file xxxx
.