utils.hf_to_ct2_converter
utils.hf_to_ct2_converter(model_path, cache_dir='models')Convert a Hugging Face Transformers model to CTranslate2 format.
Saves the converted model to the specified cache directory. If the converted model already exists, it will be reused.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| model_path | str | The Hugging Face model identifier or local path to the model to be converted. | required |
| cache_dir | str | The directory where the converted CTranslate2 model will be saved. Default is “models”. | 'models' |
Returns
| Name | Type | Description |
|---|---|---|
| str | The path to the converted CTranslate2 model directory. |
Example
ct2_model_path = hf_to_ct2_converter("KBLab/kb-whisper-large")