这是openai/whisper-large-v3的量化版本,采用INT4权重量化和FP16激活量化,适用于vLLM推理。
下载量 20
发布时间 : 2/14/2025
模型介绍
内容详情
替代品
模型简介
该模型是Whisper-large-v3的量化版本,主要用于语音识别任务,将音频转换为文本。
模型特点
高效量化
采用INT4权重量化和FP16激活量化,显著减少模型大小和内存占用
vLLM兼容
专为vLLM >= 0.5.2优化,可实现高效推理
保持高精度
在量化后仍保持接近原始模型的识别准确率
模型能力
语音识别
音频转文本
英语转录
使用案例
语音转录
会议记录
将会议录音自动转换为文字记录
WER(词错误率)约12.95%
播客转录
将播客音频内容转换为可搜索的文本
标签:
- w4a16
- int4
- vllm
- 音频
许可证: apache-2.0
许可证链接: https://huggingface.co/datasets/choosealicense/licenses/blob/main/markdown/apache-2.0.md
语言:
- 英文 基础模型: openai/whisper-large-v3 库名称: transformers
whisper-large-v3-quantized.w4a16
模型概述
- 模型架构: whisper-large-v3
- 输入: 音频-文本
- 输出: 文本
- 模型优化:
- 权重量化: INT4
- 激活量化: FP16
- 发布日期: 2025年1月31日
- 版本: 1.0
- 模型开发者: Neural Magic
openai/whisper-large-v3的量化版本。
模型优化
该模型通过将openai/whisper-large-v3的权重量化为INT4数据类型获得,准备用于vLLM >= 0.5.2的推理。
部署
与vLLM一起使用
该模型可以使用vLLM后端高效部署,如下例所示。
from vllm.assets.audio import AudioAsset
from vllm import LLM, SamplingParams
# 准备模型
llm = LLM(
model="neuralmagic/whisper-large-v3.w4a16",
max_model_len=448,
max_num_seqs=400,
limit_mm_per_prompt={"audio": 1},
)
# 准备输入
inputs = { # 测试显式编码器/解码器提示
"encoder_prompt": {
"prompt": "",
"multi_modal_data": {
"audio": AudioAsset("winning_call").audio_and_sample_rate,
},
},
"decoder_prompt": "<|startoftranscript|>",
}
# 生成响应
print("========== 示例生成 ==============")
outputs = llm.generate(inputs, SamplingParams(temperature=0.0, max_tokens=64))
print(f"提示 : {outputs[0].prompt}")
print(f"响应: {outputs[0].outputs[0].text}")
print("==================================")
vLLM还支持OpenAI兼容的服务。更多详情请参阅文档。
创建
该模型是通过llm-compressor创建的,作为多模态公告博客的一部分运行以下代码片段。
import torch
from datasets import load_dataset
from transformers import WhisperProcessor
from llmcompressor.modifiers.quantization import GPTQModifier
from llmcompressor.transformers import oneshot
from llmcompressor.transformers.tracing import TraceableWhisperForConditionalGeneration
# 选择模型并加载。
MODEL_ID = "openai/whisper-large-v3"
model = TraceableWhisperForConditionalGeneration.from_pretrained(
MODEL_ID,
device_map="auto",
torch_dtype="auto",
)
model.config.forced_decoder_ids = None
processor = WhisperProcessor.from_pretrained(MODEL_ID)
# 配置处理器的数据集任务。
processor.tokenizer.set_prefix_tokens(language="en", task="transcribe")
# 选择校准数据集。
DATASET_ID = "MLCommons/peoples_speech"
DATASET_SUBSET = "test"
DATASET_SPLIT = "test"
# 选择样本数量。512个样本是一个好的起点。
# 增加样本数量可以提高准确性。
NUM_CALIBRATION_SAMPLES = 512
MAX_SEQUENCE_LENGTH = 2048
# 加载数据集并预处理。
ds = load_dataset(
DATASET_ID,
DATASET_SUBSET,
split=f"{DATASET_SPLIT}[:{NUM_CALIBRATION_SAMPLES}]",
trust_remote_code=True,
)
def preprocess(example):
return {
"array": example["audio"]["array"],
"sampling_rate": example["audio"]["sampling_rate"],
"text": " " + example["text"].capitalize(),
}
ds = ds.map(preprocess, remove_columns=ds.column_names)
# 处理输入。
def process(sample):
inputs = processor(
audio=sample["array"],
sampling_rate=sample["sampling_rate"],
text=sample["text"],
add_special_tokens=True,
return_tensors="pt",
)
inputs["input_features"] = inputs["input_features"].to(dtype=model.dtype)
inputs["decoder_input_ids"] = inputs["labels"]
del inputs["labels"]
return inputs
ds = ds.map(process, remove_columns=ds.column_names)
# 为多模态输入定义一个一次性数据收集器。
def data_collator(batch):
assert len(batch) == 1
return {key: torch.tensor(value) for key, value in batch[0].items()}
# 配方
recipe = GPTQModifier(targets="Linear", scheme="W4A16", ignore=["lm_head"])
# 应用算法。
oneshot(
model=model,
dataset=ds,
recipe=recipe,
max_seq_length=MAX_SEQUENCE_LENGTH,
num_calibration_samples=NUM_CALIBRATION_SAMPLES,
data_collator=data_collator,
)
# 确认量化模型的生成看起来合理。
print("\n\n")
print("========== 示例生成 ==============")
sample_features = next(iter(ds))["input_features"]
sample_decoder_ids = [processor.tokenizer.prefix_tokens]
sample_input = {
"input_features": torch.tensor(sample_features).to(model.device),
"decoder_input_ids": torch.tensor(sample_decoder_ids).to(model.device),
}
output = model.generate(**sample_input, language="en")
print(processor.batch_decode(output, skip_special_tokens=True))
print("==================================\n\n")
# 这就是南方有很多窗户的地方,不,实际上那是被动太阳能
# 被动太阳能是20世纪60年代和70年代开发和设计的东西
# 在当时它是一件伟大的事情,但它不是一个被动房屋
# 保存到磁盘压缩。
SAVE_DIR = MODEL_ID.split("/")[1] + "-W4A16-G128"
model.save_pretrained(SAVE_DIR, save_compressed=True)
processor.save_pretrained(SAVE_DIR)
评估
基础模型
总测试时间: 94.4606秒
总请求数: 511
成功请求数: 511
平均延迟: 53.3529秒
中位延迟: 52.7258秒
95百分位延迟: 86.5851秒
估计请求吞吐量: 5.41 请求/秒
估计吞吐量: 100.79 令牌/秒
WER: 12.660815197787665
W4A16
总测试时间: 106.2064秒
总请求数: 511
成功请求数: 511
平均延迟: 59.7467秒
中位延迟: 58.3930秒
95百分位延迟: 97.4831秒
估计请求吞吐量: 4.81 请求/秒
估计吞吐量: 89.35 令牌/秒
WER: 12.949380786341228
BibTeX条目和引用信息
@misc{radford2022whisper,
doi = {10.48550/ARXIV.2212.04356},
url = {https://arxiv.org/abs/2212.04356},
author = {Radford, Alec and Kim, Jong Wook and Xu, Tao and Brockman, Greg and McLeavey, Christine and Sutskever, Ilya},
title = {Robust Speech Recognition via Large-Scale Weak Supervision},
publisher = {arXiv},
year = {2022},
copyright = {arXiv.org perpetual, non-exclusive license}
}
Voice Activity Detection
MIT
基于pyannote.audio 2.1版本的语音活动检测模型,用于识别音频中的语音活动时间段
语音识别
V
pyannote
7.7M
181
Wav2vec2 Large Xlsr 53 Portuguese
Apache-2.0
这是一个针对葡萄牙语语音识别任务微调的XLSR-53大模型,基于Common Voice 6.1数据集训练,支持葡萄牙语语音转文本。
语音识别
其他
W
jonatasgrosman
4.9M
32
Whisper Large V3
Apache-2.0
Whisper是由OpenAI提出的先进自动语音识别(ASR)和语音翻译模型,在超过500万小时的标注数据上训练,具有强大的跨数据集和跨领域泛化能力。
语音识别
支持多种语言
W
openai
4.6M
4,321
Whisper Large V3 Turbo
MIT
Whisper是由OpenAI开发的最先进的自动语音识别(ASR)和语音翻译模型,经过超过500万小时标记数据的训练,在零样本设置下展现出强大的泛化能力。
语音识别
Transformers

支持多种语言
W
openai
4.0M
2,317
Wav2vec2 Large Xlsr 53 Russian
Apache-2.0
基于facebook/wav2vec2-large-xlsr-53模型微调的俄语语音识别模型,支持16kHz采样率的语音输入
语音识别
其他
W
jonatasgrosman
3.9M
54
Wav2vec2 Large Xlsr 53 Chinese Zh Cn
Apache-2.0
基于facebook/wav2vec2-large-xlsr-53模型微调的中文语音识别模型,支持16kHz采样率的语音输入。
语音识别
中文
W
jonatasgrosman
3.8M
110
Wav2vec2 Large Xlsr 53 Dutch
Apache-2.0
基于facebook/wav2vec2-large-xlsr-53微调的荷兰语语音识别模型,在Common Voice和CSS10数据集上训练,支持16kHz音频输入。
语音识别
其他
W
jonatasgrosman
3.0M
12
Wav2vec2 Large Xlsr 53 Japanese
Apache-2.0
基于facebook/wav2vec2-large-xlsr-53模型微调的日语语音识别模型,支持16kHz采样率的语音输入
语音识别
日语
W
jonatasgrosman
2.9M
33
Mms 300m 1130 Forced Aligner
基于Hugging Face预训练模型的文本与音频强制对齐工具,支持多种语言,内存效率高
语音识别
Transformers

支持多种语言
M
MahmoudAshraf
2.5M
50
Wav2vec2 Large Xlsr 53 Arabic
Apache-2.0
基于facebook/wav2vec2-large-xlsr-53微调的阿拉伯语语音识别模型,在Common Voice和阿拉伯语语音语料库上训练
语音识别
阿拉伯语
W
jonatasgrosman
2.3M
37
精选推荐AI模型
Llama 3 Typhoon V1.5x 8b Instruct
专为泰语设计的80亿参数指令模型,性能媲美GPT-3.5-turbo,优化了应用场景、检索增强生成、受限生成和推理任务
大型语言模型
Transformers

支持多种语言
L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一个基于SODA数据集训练的超小型对话模型,专为边缘设备推理设计,体积仅为Cosmo-3B模型的2%左右。
对话系统
Transformers

英语
C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基于RoBERTa架构的中文抽取式问答模型,适用于从给定文本中提取答案的任务。
问答系统
中文
R
uer
2,694
98
AIbase是一个专注于MCP服务的平台,为AI开发者提供高质量的模型上下文协议服务,助力AI应用开发。
简体中文