语言: 英语
数据集:
- librispeech_asr
标签:
- 音频
- 自动语音识别
- hf-asr-leaderboard
许可证: apache-2.0
示例:
- 示例标题: Librispeech 样本 1
来源: https://cdn-media.huggingface.co/speech_samples/sample1.flac
- 示例标题: Librispeech 样本 2
来源: https://cdn-media.huggingface.co/speech_samples/sample2.flac
模型索引:
- 名称: patrickvonplaten/wav2vec2-base-960h-4-gram
结果:
- 任务:
名称: 自动语音识别
类型: automatic-speech-recognition
数据集:
名称: LibriSpeech (clean)
类型: librispeech_asr
配置: clean
分割: test
参数:
语言: en
指标:
- 名称: 测试 WER
类型: wer
值: 2.59
- 任务:
名称: 自动语音识别
类型: automatic-speech-recognition
数据集:
名称: LibriSpeech (other)
类型: librispeech_asr
配置: other
分割: test
参数:
语言: en
指标:
- 名称: 测试 WER
类型: wer
值: 6.46
Wav2Vec2-Base-960h + 4-gram
该模型与Facebook的Wav2Vec2-Base-960h完全相同,但增加了英语4-gram。使用的是Librispeech官方ngrams中的4-gram.arpa.gz
文件。
评估
以下代码片段展示了如何在LibriSpeech的“clean”和“other”测试数据上评估patrickvonplaten/wav2vec2-base-960h-4-gram。
from datasets import load_dataset
from transformers import AutoModelForCTC, AutoProcessor
import torch
from jiwer import wer
model_id = "patrickvonplaten/wav2vec2-base-960h-4-gram"
librispeech_eval = load_dataset("librispeech_asr", "other", split="test")
model = AutoModelForCTC.from_pretrained(model_id).to("cuda")
processor = AutoProcessor.from_pretrained(model_id)
def map_to_pred(batch):
inputs = processor(batch["audio"]["array"], sampling_rate=16_000, return_tensors="pt")
inputs = {k: v.to("cuda") for k,v in inputs.items()}
with torch.no_grad():
logits = model(**inputs).logits
transcription = processor.batch_decode(logits.cpu().numpy()).text[0]
batch["transcription"] = transcription
return batch
result = librispeech_eval.map(map_to_pred, remove_columns=["audio"])
print(wer(result["text"], result["transcription"]))
结果 (WER):
"clean" |
"other" |
2.59 |
6.46 |