OpenAI Whisper 各档模型测试

OpenAI Whisper 各档模型测试

因为有单机私有化部署业务需要,所以要选一款单机能hold、性能不差的模型,先看:

OpenAI Whisper:全球知名的多语言通用模型,基于海量音频数据训练,准确率高且支持多国语言与翻译

openAI Whisper 有不同大小的语音识别模型,真实场景到底用哪一个呢?我们来测试下:

模型 效果 速度 显存消耗 模型大小
turbo 🌟🌟🌟🌟🌟 🌟🌟🌟🌟🌟 ~6G 1.6G
Medium 🌟🌟🌟🌟🌟 🌟🌟 ~5G 1.5G
Small 🌟🌟🌟🌟🌟 🌟🌟🌟 ~2G 462M
tiny 🌟🌟 🌟🌟🌟🌟🌟 ~1G 73M
Base 🌟🌟🌟🌟 🌟🌟🌟🌟🌟 ~1G 139M

openAi Whisper 实际模型加载过程耗时占大部分,所以最好做成服务

测试细节

tiny 会出现繁体(命令行直接测试不会),tiny、 base 、small 句子切割有点问题,tiny、turbo 英文和数字连一起会出现识别不准

显存消耗和介绍一致

image-20260817104321888

Small

image-20260817104452344

tiny 效果太差了

image-20260817104602531

base

image-20260817104650697

直接测试

1
whisper /home/mydisk/voice_test/test2.m4a --model_dir /home/mydisk/models/whisper/ --language Chinese --device cuda --model turbo

python 测试

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
27
28
29
30
31
32
33
34
35
import whisper
import time
import argparse

# 1. 支持命令行参数:--model 传入模型名字
parser = argparse.ArgumentParser(description="Whisper 语音转文字(带计时)")
parser.add_argument("--model", required=True, help="指定模型:turbo / small / medium / large-v3")
parser.add_argument("--audio", required=True, help="音频文件路径")
args = parser.parse_args()

# 开始计时
start = time.time()

# 2. 加载模型(参数传入)
model = whisper.load_model(
name=args.model,
device="cuda",
download_root="/home/mydisk/models/whisper/"
)

# 3. 转录(最稳定、不报错)
result = model.transcribe(
audio=args.audio,
language="zh",
fp16=True,
verbose=False
)

# 输出结果(修复这里!)
print("\n识别结果:", result["text"])

# 输出耗时
end = time.time()
cost = end - start
print(f"\n执行耗时:{cost:.2f} 秒")

显存消耗

medium 模型

1
/home/mydisk/voice_test# whisper /home/mydisk/voice_test/test1.m4a --model_dir /home/mydisk/models/whisper/ --language Chinese --device cuda --model medium

![image-20260427180610104](/Users/sloong/Library/Application Support/typora-user-images/image-20260427180610104.png)

tiny

![image-20260427181206168](/Users/sloong/Library/Application Support/typora-user-images/image-20260427181206168.png)

small

![image-20260427181316635](/Users/sloong/Library/Application Support/typora-user-images/image-20260427181316635.png)

turbo

![image-20260427181428268](/Users/sloong/Library/Application Support/typora-user-images/image-20260427181428268.png)

Base

![image-20260427184910304](/Users/sloong/Library/Application Support/typora-user-images/image-20260427184910304.png)

1
2
3
4
5
6
7
8
9
10
curl -X POST http://192.168.10.78:8080/v1/audio/transcriptions \
-F "[email protected]" \
-F "model=base" \
-F "language=zh"

curl -X POST http://192.168.10.10:8080/v1/audio/transcriptions \
-F "[email protected]" \
-F "model=base" \
-F "language=zh" \
-F "init"

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×