Using Hugging Face Models in Your Software: A Detailed Guide
Hugging Face (huggingface.co) is a renowned repository for machine learning models, offering a vast collection of speech recognition models. When the built-in Faster-Whisper models provide limited support for less common languages, or if you require specialized models, Hugging Face is an ideal platform to find solutions.
This feature is available in software v3.71 and later versions, and specifically supports models that have been converted using ctranslate2
.
Step 1: Confirming Model Compatibility
Before using a Hugging Face model, you must verify that it has been converted using ctranslate2
. If the model is not ctranslate2
-converted, it cannot be used with the software.
Here are a few ways to check:
1. Explicit Page Indication
If the model page clearly states "Converted to ctranslate2" or similar wording, the model is compatible.
As shown, if the page explicitly states "converted using ctranslate2," the model is usable.
2. Check Code References
Even if not explicitly stated, you can look for code snippets like from faster_whisper
on the model's page. Models with such references are generally compatible.
3. Examine the config.json
File Structure
If the first two methods don't provide a clear answer, click on the Files and versions
tab on the model page, then locate and click on the config.json
file.
If the config.json
file structure resembles the image below—for example, starting with alignment_heads
and containing lang_ids
among other fields—the model is typically compatible.
Step 2: Obtain and Configure the Model ID
Once you've confirmed model compatibility, you can add it to your software.
1. Obtain the Model ID
A Model ID consists of two parts, separated by a /
: username/model_name
. For example: zh-plus/faster-whisper-large-v2-japanese-5k-steps
.
You can often find and click a "Copy" button directly on the model's detail page to get the Model ID, as shown below:
2. Add the Model ID to the Software
- Open the software and navigate to
Menu
->Tools
->Advanced Options
. - In the
Faster and OpenAI Model List
text box, paste the copied Model ID to the end of the existing content, ensuring it's preceded by an English comma,
. - Click
Save
to apply the changes.
Step 3: Usage and Automatic Model Download
- Return to the software's main interface.
- From the
Speech Recognition
dropdown list, selectfaster-whisper (local)
. - In the
Model
dropdown list on the right, choose the Model ID you just added.
The software will automatically download the model from the domestic mirror site https://hf-mirror.com
, eliminating the need for a VPN/proxy.
Important Considerations
1. Model Availability Limitations
The software only supports downloading publicly available models from Hugging Face. Models that require you to agree to specific terms (e.g., license agreements), as shown below, cannot be automatically downloaded or used.
2. Usage of Domestic Mirror Site
- When the software interface language is set to Chinese, the software will automatically use the
https://hf-mirror.com
domestic mirror site for model downloads, thus avoiding the need for a VPN/proxy. - If the software interface is in English, it will still attempt to download from the official Hugging Face website, which might require a VPN/proxy.
- To change the interface to Chinese, navigate to
Menu
->Tools
->Advanced Options
->Interface Language
, enterzh
, save the settings, and then restart the software.