指定路径下载 Whisper 模型:从 base 到 large-v3 的代码实现与链接
Whisper 模型下载指南
Whisper 是 OpenAI 开源的语音识别模型,支持多语言转录。以下是使用 Hugging Face Hub 下载从 base 到 large-v3 所有版本的完整实现方案:
安装依赖
pip install transformers huggingface_hub Python 下载代码
from huggingface_hub import snapshot_download # 模型版本列表 model_versions = [ "openai/whisper-base", "openai/whisper-small", "openai/whisper-medium", "openai/whisper-large", "openai/whisper-large-v2", "openai/whisper-large-v3" ] # 指定本地存储路径 download_path = "./whisper_models" for model_id in model_versions: # 创建版本子目录 version_dir = f"{download_path}/{model_id.split('/')[-1]}" # 下载模型文件 snapshot_download( repo_id=model_id, local_dir=version_dir, local_dir_use_symlinks=False, resume_download=True ) print(f"✅ {model_id} 下载完成") 关键参数说明
local_dir:自定义存储路径resume_download=True:支持断点续传
文件结构示例:
whisper_models/ ├── whisper-base ├── whisper-small ├── whisper-medium ├── whisper-large ├── whisper-large-v2 └── whisper-large-v3 模型规格对比
| 版本 | 参数量 | 磁盘占用 | 适用场景 |
|---|---|---|---|
| base | 74M | ~150MB | 移动端部署 |
| small | 244M | ~500MB | 实时转录 |
| medium | 769M | ~1.5GB | 通用场景 |
| large | 1550M | ~3GB | 高精度转录 |
| large-v2 | 1550M | ~3GB | 多语言优化 |
| large-v3 | 1550M | ~3GB | 最新版本 |
官方模型链接
- 所有 Whisper 模型主页
- 直接下载地址:
- Base:
https://huggingface.co/openai/whisper-base - Small:
https://huggingface.co/openai/whisper-small - Medium:
https://huggingface.co/openai/whisper-medium - Large:
https://huggingface.co/openai/whisper-large - Large-v2:
https://huggingface.co/openai/whisper-large-v2 - Large-v3:
https://huggingface.co/openai/whisper-large-v3
- Base:
注意:完整下载需约 10GB 磁盘空间使用 VPN 可加速下载首次运行会自动创建目录结构支持增量下载,重复执行只下载缺失文件