2024-03-22-whisper

  1. 2024-03-22-whisper
    1. 环境说明
    2. 代码下载
    3. 模型下载
    4. 安装环境
      1. requirements-smile.txt
    5. 配置
    6. 使用
      1. 命令行操作
      2. 代码操作

2024-03-22-whisper

环境说明

系统环境:Windows 10
cuda版本: 11.7
python版本:3.9.9
软件版本:v20230117
显卡版本:
硬件设备:

代码下载

1
2
3
git clone https://github.com/openai/whisper.git
cd whisper
git checkout ba3f3cd54b0e5b8ce1ab3de13e32122d0d5f98ab

模型下载

官方模型下载地址

1
2
3
4
5
6
7
8
9
10
11
12
"tiny.en": "https://openaipublic.azureedge.net/main/whisper/models/d3dd57d32accea0b295c96e26691aa14d8822fac7d9d27d5dc00b4ca2826dd03/tiny.en.pt",
"tiny": "https://openaipublic.azureedge.net/main/whisper/models/65147644a518d12f04e32d6f3b26facc3f8dd46e5390956a9424a650c0ce22b9/tiny.pt",
"base.en": "https://openaipublic.azureedge.net/main/whisper/models/25a8566e1d0c1e2231d1c762132cd20e0f96a85d16145c3a00adf5d1ac670ead/base.en.pt",
"base": "https://openaipublic.azureedge.net/main/whisper/models/ed3a0b6b1c0edf879ad9b11b1af5a0e6ab5db9205f891f668f8b0e6c6326e34e/base.pt",
"small.en": "https://openaipublic.azureedge.net/main/whisper/models/f953ad0fd29cacd07d5a9eda5624af0f6bcf2258be67c92b79389873d91e0872/small.en.pt",
"small": "https://openaipublic.azureedge.net/main/whisper/models/9ecf779972d90ba49c06d968637d720dd632c55bbf19d441fb42bf17a411e794/small.pt",
"medium.en": "https://openaipublic.azureedge.net/main/whisper/models/d7440d1dc186f76616474e0ff0b3b6b879abc9d1a4926b7adfa41db2d497ab4f/medium.en.pt",
"medium": "https://openaipublic.azureedge.net/main/whisper/models/345ae4da62f9b3d59415adc60127b97c714f32e89e936602e85993674d08dcb1/medium.pt",
"large-v1": "https://openaipublic.azureedge.net/main/whisper/models/e4b87e7e0bf463eb8e6956e646f1e277e901512310def2c24bf0e11bd3c28e9a/large-v1.pt",
"large-v2": "https://openaipublic.azureedge.net/main/whisper/models/81f7c96c852ee8fc832187b0132e569d6c3065a3252ed18e56effd0b6a73e524/large-v2.pt",
"large-v3": "https://openaipublic.azureedge.net/main/whisper/models/e5b1a55b89c1367dacf97e3e19bfd829a01529dbfdeefa8caeb59b3f1b81dadb/large-v3.pt",
"large": "https://openaipublic.azureedge.net/main/whisper/models/e5b1a55b89c1367dacf97e3e19bfd829a01529dbfdeefa8caeb59b3f1b81dadb/large-v3.pt",

安装环境

1
2
3
pip install torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cu121
cd whisper
python setup.py install

requirements-smile.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
certifi==2024.2.2
charset-normalizer==3.3.2
colorama==0.4.6
filelock==3.9.0
fsspec==2023.4.0
idna==3.6
Jinja2==3.1.2
llvmlite==0.42.0
MarkupSafe==2.1.3
more-itertools==10.2.0
mpmath==1.3.0
networkx==3.2.1
numba==0.59.1
numpy==1.24.1
openai-whisper==20231117
Pillow==8.4.0
regex==2023.12.25
requests==2.31.0
sympy==1.12
tiktoken==0.6.0
torch==2.2.1+cu121
torchaudio==2.2.1+cu121
torchvision==0.17.1+cu121
tqdm==4.66.2
typing_extensions==4.8.0
urllib3==2.2.1

配置

使用

命令行操作

1
whisper audio.flac audio.mp3 audio.wav --model medium

代码操作

1
2
3
4
5
import whisper

model = whisper.load_model("base")
result = model.transcribe("audio.mp3")
print(result["text"])

微信:宏沉一笑
公众号:登山客

签名:Smile every day
名字:宏沉一笑
邮箱:whghcyx@outlook.com
个人网站:https://whg555.github.io



转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 whghcyx@outlook.com

文章标题:2024-03-22-whisper

文章字数:601

本文作者:宏沉一笑

发布时间:2024-03-22, 19:55:07

最后更新:2024-03-22, 20:30:24

原始链接:https://whghcyx.gitee.io/2024/03/22/AI-%E6%A1%86%E6%9E%B6-2024-03-22-whisper/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏