espnet2.asr.encoder.wav2vec2_encoder.download_w2v
Less than 1 minute
espnet2.asr.encoder.wav2vec2_encoder.download_w2v
espnet2.asr.encoder.wav2vec2_encoder.download_w2v(model_url, dir_path)
Download the Wav2Vec2.0 pretrained model and its dictionary file.
This function downloads the specified Wav2Vec2.0 model from a given URL and saves it to the specified directory. It also downloads the associated dictionary file necessary for the model’s operation.
- Parameters:
- model_url (str) – The URL to the Wav2Vec2.0 pretrained model.
- dir_path (str) – The directory path where the model will be downloaded.
- Returns: The path to the downloaded Wav2Vec2.0 model file.
- Return type: str
- Raises:
- Exception – If there is an issue with downloading the model or creating
- directories. –
Examples
>>> model_url = "https://path/to/wav2vec2/model"
>>> dir_path = "./models"
>>> model_path = download_w2v(model_url, dir_path)
>>> print(model_path)
./models/model
NOTE
This function uses a file lock to prevent concurrent downloads of the same model.