espnet2.asr.encoder.avhubert_encoder.download_avhubert
Less than 1 minute
espnet2.asr.encoder.avhubert_encoder.download_avhubert
espnet2.asr.encoder.avhubert_encoder.download_avhubert(model_url, dir_path)
Download the AVHubert model from a specified URL.
This function checks if the model already exists in the specified directory. If not, it will download the model and save it in the specified directory, using a file lock to ensure that concurrent downloads do not occur.
- Parameters:
- model_url (str) – The URL from which to download the AVHubert model.
- dir_path (str) – The directory path where the model should be saved.
- Returns: The file path of the downloaded model.
- Return type: str
- Raises:Exception – If there is an issue with downloading the model.
Examples
>>> model_url = "https://dl.fbaipublicfiles.com/avhubert/model/lrs3_vox/noise-pretrain/large_vox_iter5.pt"
>>> dir_path = "./models"
>>> model_path = download_avhubert(model_url, dir_path)
AVHubert model downloaded ./models/large_vox_iter5.pt