Wav2vec2 Xls R 1b Tevr
这是一个德语语音识别模型,采用wav2vec 2.0 XLS-R 1B架构并引入TEVR(标记熵方差降低)技术,结合5-gram语言模型,在Common Voice德语测试集上取得了3.64%的词错误率。
下载量 311
发布时间 : 6/2/2022
模型简介
该模型是一个高性能德语自动语音识别系统,通过TEVR技术优化了标记生成过程,显著提升了识别准确率。
模型特点
TEVR技术增强
通过标记熵方差降低技术优化语音识别性能,提升模型准确率
高性能语言模型集成
结合5-gram KenLM语言模型,显著降低识别错误率
德语优化
专门针对德语语音特点进行优化,处理德语特有字符和发音
模型能力
德语语音转文本
高精度语音识别
实时语音处理
使用案例
语音转录
德语会议记录
将德语会议录音自动转换为文字记录
词错误率低至3.64%
语音助手
为德语语音助手提供高精度语音识别能力
无障碍技术
实时字幕生成
为德语视频内容生成实时字幕
🚀 德语语音识别模型
本项目提供了一个完整训练的德语语音识别管道,结合了先进的声学模型和语言模型,能够高效准确地识别德语语音,在CommonVoice德语数据集上取得了优异的成绩。
📚 详细文档
概述
此文件夹包含一个经过完全训练的德语语音识别管道,该管道由使用新型wav2vec 2.0 XLS - R 1B TEVR 架构的声学模型和一个5 - 元KenLM语言模型组成。有关TEVR增强功能及其动机的解释,请参阅我们的论文:TEVR: Improving Speech Recognition by Token Entropy Variance Reduction。
截至2022年6月,该管道在CommonVoice德语数据集上的单词错误率(WER)为3.64% ,表现极具竞争力。字符错误率(CER)为1.54%。
引用
如果您将此自动语音识别(ASR)管道用于研究,请引用以下文献:
@misc{https://doi.org/10.48550/arxiv.2206.12693,
doi = {10.48550/ARXIV.2206.12693},
url = {https://arxiv.org/abs/2206.12693},
author = {Krabbenhöft, Hajo Nils and Barth, Erhardt},
keywords = {Computation and Language (cs.CL), Sound (cs.SD), Audio and Speech Processing (eess.AS), FOS: Computer and information sciences, FOS: Computer and information sciences, FOS: Electrical engineering, electronic engineering, information engineering, FOS: Electrical engineering, electronic engineering, information engineering, F.2.1; I.2.6; I.2.7},
title = {TEVR: Improving Speech Recognition by Token Entropy Variance Reduction},
publisher = {arXiv},
year = {2022},
copyright = {Creative Commons Attribution 4.0 International}
}
TEVR分词器创建/测试
有关以下内容,请参阅https://huggingface.co/fxtentacle/tevr-token-entropy-predictor-de:
- 我们训练的用于计算论文中熵的ByT5模型
- 一个从文本语料库生成TEVR分词器的Jupyter Notebook
- 一个生成论文中插图的Jupyter Notebook
评估
若要自己评估此管道和/或在您自己的数据上进行评估,请查看HF Eval Script.ipynb
Jupyter Notebook,或使用以下Python脚本:
💻 使用示例
基础用法
!pip install --quiet --root-user-action=ignore --upgrade pip
!pip install --quiet --root-user-action=ignore "datasets>=1.18.3" "transformers==4.11.3" librosa jiwer huggingface_hub
!pip install --quiet --root-user-action=ignore https://github.com/kpu/kenlm/archive/master.zip pyctcdecode
!pip install --quiet --root-user-action=ignore --upgrade transformers
!pip install --quiet --root-user-action=ignore torch_audiomentations audiomentations
from datasets import load_dataset, Audio, load_metric
from transformers import AutoModelForCTC, Wav2Vec2ProcessorWithLM
import torchaudio.transforms as T
import torch
import unicodedata
import numpy as np
import re
# load testing dataset
testing_dataset = load_dataset("common_voice", "de", split="test")
# replace invisible characters with space
allchars = list(set([c for t in testing_dataset['sentence'] for c in list(t)]))
map_to_space = [c for c in allchars if unicodedata.category(c)[0] in 'PSZ' and c not in 'ʻ-']
replacements = ''.maketrans(''.join(map_to_space), ''.join(' ' for i in range(len(map_to_space))), '\'ʻ')
def text_fix(text):
# change ß to ss
text = text.replace('ß','ss')
# convert dash to space and remove double-space
text = text.replace('-',' ').replace(' ',' ').replace(' ',' ')
# make lowercase
text = text.lower()
# remap all invisible characters to space
text = text.translate(replacements).strip()
# for easier comparison to Zimmermeister, replace unrepresentable characters with ?
text = re.sub("[âşěýňעảנźțãòàǔł̇æồאắîשðșęūāñë生בøúıśžçćńřğ]+","?",text)
# remove multiple spaces (again)
text = ' '.join([w for w in text.split(' ') if w != ''])
return text
# load model
model = AutoModelForCTC.from_pretrained("fxtentacle/wav2vec2-xls-r-1b-tevr")
model.to('cuda')
# load processor
class HajoProcessor(Wav2Vec2ProcessorWithLM):
@staticmethod
def get_missing_alphabet_tokens(decoder, tokenizer):
return []
processor = HajoProcessor.from_pretrained("fxtentacle/wav2vec2-xls-r-1b-tevr")
# this function will be called for each WAV file
def predict_single_audio(batch, image=False):
audio = batch['audio']['array']
# resample, if needed
if batch['audio']['sampling_rate'] != 16000:
audio = T.Resample(orig_freq=batch['audio']['sampling_rate'], new_freq=16000)(torch.from_numpy(audio)).numpy()
# normalize
audio = (audio - audio.mean()) / np.sqrt(audio.var() + 1e-7)
# ask HF processor to prepare audio for GPU eval
input_values = processor(audio, return_tensors="pt", sampling_rate=16_000).input_values
# call model on GPU
with torch.no_grad():
logits = model(input_values.to('cuda')).logits.cpu().numpy()[0]
# ask HF processor to decode logits
decoded = processor.decode(logits, beam_width=500)
# return as dictionary
return { 'groundtruth': text_fix(batch['sentence']), 'prediction': decoded.text }
# process all audio files
all_predictions = testing_dataset.map(predict_single_audio, remove_columns=testing_dataset.column_names)
# print results
print('WER', load_metric("wer").compute(predictions=all_predictions['prediction'], references=all_predictions['groundtruth'])*100.0, '%')
print('CER', load_metric("cer").compute(predictions=all_predictions['prediction'], references=all_predictions['groundtruth'])*100.0, '%')
运行上述脚本后,输出结果如下:
WER 3.6433399042523233 %
CER 1.5398893560981173 %
📄 许可证
本项目采用Apache 2.0许可证。
📋 模型信息
属性 | 详情 |
---|---|
模型类型 | wav2vec 2.0 XLS - R 1B + TEVR tokens + 5 - gram LM by Hajo Nils Krabbenhöft |
训练数据 | Common Voice |
评估指标 | 单词错误率(WER)、字符错误率(CER) |
测试WER | 3.6433399042523233 |
测试CER | 1.5398893560981173 |
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