Wav2vec2 Large Xlsr Vietnamese
这是一个基于facebook/wav2vec2-large-xlsr-53模型在越南语上微调的语音识别模型,使用了Common Voice和Infore_25h数据集进行训练。
下载量 37
发布时间 : 3/2/2022
模型简介
该模型专门用于越南语语音识别任务,支持16kHz采样率的语音输入。
模型特点
多数据集训练
使用了Common Voice和Infore_25h两个数据集进行训练,提高了模型的泛化能力。
16kHz采样率支持
专门优化支持16kHz采样率的语音输入识别。
无需语言模型
可以直接使用,无需额外的语言模型支持。
模型能力
越南语语音识别
自动语音转文本
使用案例
语音转写
越南语语音转录
将越南语语音内容转换为文本
在Common Voice越南语测试集上WER为58.63%
语音助手
越南语语音指令识别
用于越南语语音助手的基础语音识别组件
🚀 Wav2Vec2-Large-XLSR-53-Vietnamese
该项目基于 facebook/wav2vec2-large-xlsr-53 模型,使用越南语的 Common Voice 和 Infore_25h 数据集(密码:BroughtToYouByInfoRe)进行微调。该模型可用于越南语的自动语音识别任务,为越南语语音处理提供了有效的解决方案。
属性 | 详情 |
---|---|
模型类型 | 用于越南语自动语音识别的微调模型 |
训练数据 | Common Voice 的训练集、验证集和 Infore_25h 数据集 |
🚀 快速开始
使用此模型时,请确保语音输入的采样率为 16kHz。
✨ 主要特性
- 基于预训练的 facebook/wav2vec2-large-xlsr-53 模型进行越南语微调。
- 可直接用于越南语的自动语音识别任务,无需语言模型。
📦 安装指南
文档未提供具体安装命令,跳过此章节。
💻 使用示例
基础用法
import torch
import torchaudio
from datasets import load_dataset
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
test_dataset = load_dataset("common_voice", "vi", split="test[:2%]")
processor = Wav2Vec2Processor.from_pretrained("CuongLD/wav2vec2-large-xlsr-vietnamese")
model = Wav2Vec2ForCTC.from_pretrained("CuongLD/wav2vec2-large-xlsr-vietnamese")
resampler = torchaudio.transforms.Resample(48_000, 16_000)
# Preprocessing the datasets.
# We need to read the aduio files as arrays
def speech_file_to_array_fn(batch):
speech_array, sampling_rate = torchaudio.load(batch["path"])
batch["speech"] = resampler(speech_array).squeeze().numpy()
return batch
test_dataset = test_dataset.map(speech_file_to_array_fn)
inputs = processor(test_dataset["speech"][:2], sampling_rate=16_000, return_tensors="pt", padding=True)
with torch.no_grad():
logits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits
predicted_ids = torch.argmax(logits, dim=-1)
print("Prediction:", processor.batch_decode(predicted_ids))
print("Reference:", test_dataset["sentence"][:2])
高级用法
import torch
import torchaudio
from datasets import load_dataset, load_metric
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
import re
test_dataset = load_dataset("common_voice", "vi", split="test")
wer = load_metric("wer")
processor = Wav2Vec2Processor.from_pretrained("CuongLD/wav2vec2-large-xlsr-vietnamese")
model = Wav2Vec2ForCTC.from_pretrained("CuongLD/wav2vec2-large-xlsr-vietnamese")
model.to("cuda")
chars_to_ignore_regex = '[\,\?\.\!\-\;\:\"\“]'
resampler = torchaudio.transforms.Resample(48_000, 16_000)
# Preprocessing the datasets.
# We need to read the aduio files as arrays
def speech_file_to_array_fn(batch):
batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
speech_array, sampling_rate = torchaudio.load(batch["path"])
batch["speech"] = resampler(speech_array).squeeze().numpy()
return batch
test_dataset = test_dataset.map(speech_file_to_array_fn)
# Preprocessing the datasets.
# We need to read the aduio files as arrays
def evaluate(batch):
inputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
with torch.no_grad():
logits = model(inputs.input_values.to("cuda"), attention_mask=inputs.attention_mask.to("cuda")).logits
pred_ids = torch.argmax(logits, dim=-1)
batch["pred_strings"] = processor.batch_decode(pred_ids)
return batch
result = test_dataset.map(evaluate, batched=True, batch_size=8)
print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"])))
测试结果:58.63 %
📚 详细文档
训练
使用 Common Voice 的 train
、validation
数据集和 Infore_25h
数据集进行训练。训练脚本可在 此处 找到。
如何评估训练的检查点
上传模型后,需要进行最终评估。只需将模型卡片中的评估代码复制到 Python 脚本中并运行即可。请务必在模型卡片的 YAML 标签顶部和评估代码下方的“测试结果”部分记录最终结果。
训练和评估规则
- 训练数据:除官方 Common Voice 的
test
数据集外,所有数据都可用于训练。对于在 Common Voice 中未包含的语言进行训练的模型,模型作者应留出合理数量的数据用于评估。 - 数据预处理:允许(并推荐)将数据归一化为仅包含小写字符,也允许(并推荐)去除排版符号和标点符号。但不应去除会改变单词含义的符号,例如英语中的单引号
'
。
技巧和窍门
- 如何合并多个数据集:查看 此帖子。
- 如何有效预处理数据:文档未提供具体内容,跳过。
- 如何在有限的内存和硬盘空间下高效加载数据集:查看 此帖子。
- 如何进行超参数调优:文档未提供具体内容,跳过。
- 如何预处理和评估基于字符的语言:文档未提供具体内容,跳过。
进一步阅读材料
建议花时间了解 Wav2vec2 的理论工作原理,这有助于微调模型。以下是一些重要的参考资源:
- Facebook 的 Wav2Vec2 博客文章
- 官方 Wav2Vec2 论文
- 官方 XLSR Wav2vec2 论文
- Hugging Face 博客
- CTC(Connectionist Temporal Classification)工作原理
常见问题解答
- 参与者可以为多种语言微调模型吗? 可以,参与者可以根据自己的喜好为多种语言微调模型。
- 参与者可以使用额外的数据(除了 Common Voice 数据)吗? 可以,除官方 Common Voice 的
test
数据外,所有数据都可用于训练。如果参与者想在 Common Voice 中未包含的语言上训练模型,应留出一些测试数据以确保模型不过拟合。 - 我们可以为高资源语言进行微调吗? 可以,虽然不建议对英语进行微调,因为已经有很多英语的微调语音识别模型。但如果参与者想对其他“高资源”语言(如法语、西班牙语或德语)进行微调,是非常受欢迎的。对于这种情况,可能需要在本地训练并应用一些技巧,如懒数据加载(更多细节请查看 "懒数据加载" 部分)。
📄 许可证
本项目采用 Apache-2.0 许可证。
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