I'm trying to load a pretrained SpeechBrain HuggingFace model from local files; I don't want it to call out to HuggingFace to download. However, unless I change the pretrained_path
in hyperparams.yaml
, it is still calling out to HuggingFace and downloading the models from HF.
from speechbrain.pretrained import EncoderClassifier
model_folder = "/local/path/to/folder/with/model_files"
model = EncoderClassifier.from_hparams(source=model_folder)
To get the model files into a local directory:
- I downloaded the model from HuggingFace.
- I moved the actual model files in
~/.cache/huggingface/hub/
tomodel_folder
path. I also renamed them to their symlinked names:embedding_model.ckpt
,label_encoder.ckpt
, andclassifier.ckpt
. - I then tried changing
pretrained_path
inhyperparams.yaml
tomodel_folder
. But that causes the model to not load properly.
HF model: https://huggingface.co/TalTechNLP/voxlingua107-epaca-tdnn
What's the right way to load an EncoderClassifier
from local files?