ONNX 模型库
返回模型

说明文档

模型详情:INT8 Whisper large

Whisper 是一个用于自动语音识别(ASR)和语音翻译的预训练模型。该模型在 680k 小时的标注数据上训练,Whisper 模型展示了强大的泛化能力,无需微调即可适应许多数据集和领域。

此 int8 ONNX 模型由 neural-compressor 生成,fp32 模型可通过以下命令导出:

optimum-cli export onnx --model openai/whisper-large whisper-large-with-past/ --task automatic-speech-recognition-with-past --opset 13
模型详情 描述
模型作者 - 公司 Intel
日期 2022年5月15日
版本 1
类型 语音识别
论文或其他资源 -
许可证 Apache 2.0
问题或评论 社区讨论区
预期用途 描述
主要预期用途 您可以使用原始模型进行自动语音识别推理
主要预期用户 任何进行自动语音识别推理的人
超出范围的用途 在大多数情况下,此模型需要针对您的特定任务进行微调。该模型不应用于故意为人们制造敌对或疏离的环境。

如何使用

通过克隆仓库下载模型:

git clone https://huggingface.co/Intel/whisper-large-int8-static

使用以下代码评估模型:

import os
from evaluate import load
from datasets import load_dataset
from transformers import WhisperForConditionalGeneration, WhisperProcessor, AutoConfig

model_name = 'openai/whisper-large'
model_path = 'whisper-large-int8-static'
processor = WhisperProcessor.from_pretrained(model_name)
model = WhisperForConditionalGeneration.from_pretrained(model_name)
config = AutoConfig.from_pretrained(model_name)
wer = load(\"wer\")
librispeech_test_clean = load_dataset(\"librispeech_asr\", \"clean\", split=\"test\")

from optimum.onnxruntime import ORTModelForSpeechSeq2Seq
from transformers import PretrainedConfig
model_config = PretrainedConfig.from_pretrained(model_name)
predictions = []
references = []
sessions = ORTModelForSpeechSeq2Seq.load_model(
            os.path.join(model_path, 'encoder_model.onnx'),
            os.path.join(model_path, 'decoder_model.onnx'),
            os.path.join(model_path, 'decoder_with_past_model.onnx'))
model = ORTModelForSpeechSeq2Seq(sessions[0], sessions[1], model_config, model_path, sessions[2])
for idx, batch in enumerate(librispeech_test_clean):
    audio = batch[\"audio\"]
    input_features = processor(audio[\"array\"], sampling_rate=audio[\"sampling_rate\"], return_tensors=\"pt\").input_features
    reference = processor.tokenizer._normalize(batch['text'])
    references.append(reference)
    predicted_ids = model.generate(input_features)[0]
    transcription = processor.decode(predicted_ids)
    prediction = processor.tokenizer._normalize(transcription)
    predictions.append(prediction)
wer_result = wer.compute(references=references, predictions=predictions)
print(f\"Result wer: {wer_result * 100}\")
accuracy = 1 - wer_result
print(\"Accuracy: %.5f\" % accuracy)

指标(模型性能):

模型 模型大小 (GB) wer
FP32 9.4 3.04
INT8 2.4 2.94

Intel/whisper-large-int8-static-inc

作者 Intel

automatic-speech-recognition transformers
↓ 1 ♥ 0

创建时间: 2023-05-10 08:34:48+00:00

更新时间: 2023-05-18 11:14:12+00:00

在 Hugging Face 上查看

文件 (16)

.gitattributes
README.md
added_tokens.json
config.json
decoder_model.onnx ONNX
decoder_with_past_model.onnx ONNX
encoder_model.onnx ONNX
generation_config.json
int8_weights.pb
merges.txt
normalizer.json
preprocessor_config.json
special_tokens_map.json
tokenizer.json
tokenizer_config.json
vocab.json