Wav2vec2 Large Xlsr Open Brazilian Portuguese
W
Wav2vec2 Large Xlsr Open Brazilian Portuguese
由 lgris 开发
这是一个针对巴西葡萄牙语微调的 Wav2vec 2.0 模型,使用了多个开放巴西葡萄牙语数据集进行训练,包括 Common Voice、MLS、CETUC 等。
下载量 395
发布时间 : 3/2/2022
模型简介
该模型是一个自动语音识别(ASR)模型,专门针对巴西葡萄牙语进行了优化,能够将葡萄牙语语音转换为文本。
模型特点
多数据集训练
结合了多个巴西葡萄牙语数据集(CETUC、MLS、VoxForge、Common Voice 和 Lapsbm)进行训练,提高了模型的泛化能力。
高性能
在 Common Voice 测试集上取得了 12.9% 的词错误率(WER),表现出色。
开放数据
完全基于开放数据集训练,确保了模型的透明性和可重复性。
模型能力
巴西葡萄牙语语音识别
长音频处理
多种口音适应
使用案例
语音转文字
语音转录
将巴西葡萄牙语语音内容转换为文字记录
在标准测试集上达到12.9%的词错误率
辅助技术
语音控制应用
为巴西葡萄牙语用户提供语音控制界面
🚀 基于巴西葡萄牙语开放数据集的Wav2vec 2.0模型
本项目展示了一个针对巴西葡萄牙语进行微调的Wav2vec模型,使用了以下数据集:
- CETUC:包含约145小时的巴西葡萄牙语语音,分布在50名男性和50名女性说话者中,每人朗读约1000个从CETEN - Folha语料库中选出的语音平衡句子。
- 多语言Librispeech (MLS):一个多语言的大规模数据集。MLS基于LibriVox等公共领域的有声读物录音。该数据集包含多种语言的总计6000小时转录数据。本项目使用的葡萄牙语数据集(主要是巴西变体)约有284小时的语音,来自62位朗读者朗读的55本有声读物。
- VoxForge:一个旨在为声学模型构建开放数据集的项目。该语料库包含约100名说话者和4130条巴西葡萄牙语语音,采样率从16kHz到44.1kHz不等。
- Common Voice 6.1(仅用于训练):由Mozilla基金会发起的项目,旨在创建多种语言的开放数据集以训练自动语音识别模型。志愿者通过官方网站捐赠和验证语音数据。本项目使用的葡萄牙语数据集(主要是巴西变体)为6.1版本(pt_63h_2020 - 12 - 11),包含约50小时的验证数据和1120名独特的说话者。
- [Lapsbm](https://github.com/falabrasil/gitlab - resources):“Falabrasil - UFPA”是Fala Brasil团队用于评估巴西葡萄牙语自动语音识别系统的数据集。包含35名说话者(10名女性),每人朗读20条独特的句子,总计700条巴西葡萄牙语语音。音频以22.05kHz采样,未进行环境控制。
这些数据集被合并以构建一个更大的巴西葡萄牙语数据集。除了Common Voice的开发集和测试集分别用于验证和测试外,所有数据都用于训练。
原始模型使用fairseq进行微调。本项目使用的是原始模型的转换版本。原始fairseq模型的链接[在此](https://drive.google.com/drive/folders/1XTKIUB4kp3oYOavwH97wq8IPFsxP5sNz?usp = sharing)。
该模型经过80000次更新训练。
✨ 主要特性
数据集实例和帧数分布
下图展示了数据集的整体分布情况:
转录示例
原文 | 转录结果 |
---|---|
É comum os usuários confundirem software livre com software livre | É comum os usuares confunder em softwerlivr com softwerlivre |
Ele fez tanto ghostwriting que ele começa a se sentir como um fantasma também | Ele fez tanto golstraitn que ele começou a se sentir como um fantasma também |
Arnold apresentou um gráfico mostrando quantas cegonhas ele havia contado nos últimos dez anos | Arnold apresentou um gráfico mostrando quantas segonhas ele havia contado nos últimos dez anos |
Mais cedo ou mais tarde eles descobrirão como ler esses hieróglifos | Mais sedo ou mais tarde eles descobriram como de esses ierogrôficos |
Viver juntos compartilhar objetivos e ter um bom relacionamento | E ver juntos signafica viver juntos ou fartlhar objetivos ter um bom relacionamentoo |
Da mesma forma uma patente pode impedir que concorrentes desenvolvam produtos similares | Da mesma forma uma patente pode impedir que concorrentes desenvolva produtos similares |
Duas mulheres e uma menina levantam com troféus | Duas mulheres e uma menina levantam com trofés |
Esse acrobata de circo deve ter um sistema vestibular bem treinado pensou o espectador | Esse acrobata de cirko deve ter um sistema vestibular bemtreinado pensou o espectador |
Durante a exposição o tribunal pode fazer quaisquer perguntas ou esclarecimentos que considere apropriados | Durante a exposição o tribunal pode fazer quaisquer perguntas ou esclarecimentos que considere apropriado |
📦 安装指南
导入依赖库
%%capture
!pip install datasets
!pip install jiwer
!pip install torchaudio
!pip install transformers
!pip install soundfile
import torchaudio
from datasets import load_dataset, load_metric
from transformers import (
Wav2Vec2ForCTC,
Wav2Vec2Processor,
)
import torch
import re
import sys
💻 使用示例
基础用法
chars_to_ignore_regex = '[\,\?\.\!\;\:\"]' # noqa: W605
wer = load_metric("wer")
device = "cuda"
model_name = 'lgris/wav2vec2-large-xlsr-open-brazilian-portuguese'
model = Wav2Vec2ForCTC.from_pretrained(model_name).to(device)
processor = Wav2Vec2Processor.from_pretrained(model_name)
def map_to_pred(batch):
features = processor(batch["speech"], sampling_rate=batch["sampling_rate"][0], padding=True, return_tensors="pt")
input_values = features.input_values.to(device)
attention_mask = features.attention_mask.to(device)
with torch.no_grad():
logits = model(input_values, attention_mask=attention_mask).logits
pred_ids = torch.argmax(logits, dim=-1)
batch["predicted"] = processor.batch_decode(pred_ids)
batch["predicted"] = [pred.lower() for pred in batch["predicted"]]
batch["target"] = batch["sentence"]
return batch
测试
针对Common Voice(域内)的测试
dataset = load_dataset("common_voice", "pt", split="test", data_dir="./cv-corpus-6.1-2020-12-11")
resampler = torchaudio.transforms.Resample(orig_freq=48_000, new_freq=16_000)
def map_to_array(batch):
speech, _ = torchaudio.load(batch["path"])
batch["speech"] = resampler.forward(speech.squeeze(0)).numpy()
batch["sampling_rate"] = resampler.new_freq
batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower().replace("’", "'")
return batch
ds = dataset.map(map_to_array)
result = ds.map(map_to_pred, batched=True, batch_size=1, remove_columns=list(ds.features.keys()))
print(wer.compute(predictions=result["predicted"], references=result["target"]))
for pred, target in zip(result["predicted"][:10], result["target"][:10]):
print(pred, "|", target)
结果:12.90%
针对TEDx(域外)的测试
!gdown --id 1HJEnvthaGYwcV_whHEywgH2daIN4bQna
!tar -xf tedx.tar.gz
dataset = load_dataset('csv', data_files={'test': 'tedx/test.csv'})['test']
def map_to_array(batch):
speech, _ = torchaudio.load(batch["path"])
batch["speech"] = speech.squeeze(0).numpy()
batch["sampling_rate"] = resampler.new_freq
batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower().replace("’", "'")
return batch
ds = dataset.map(map_to_array)
result = ds.map(map_to_pred, batched=True, batch_size=1, remove_columns=list(ds.features.keys()))
print(wer.compute(predictions=result["predicted"], references=result["target"]))
for pred, target in zip(result["predicted"][:10], result["target"][:10]):
print(pred, "|", target)
结果:35.21%
📄 许可证
本项目采用Apache 2.0许可证。
信息表格
属性 | 详情 |
---|---|
模型类型 | Lucas Gris XLSR Wav2Vec2 Large 53巴西葡萄牙语模型 |
训练数据 | CETUC、Multilingual Librispeech (MLS)、VoxForge、Common Voice 6.1、Lapsbm |
评估指标 | 词错误率(WER) |
任务类型 | 自动语音识别 |
测试WER | 12.905054857823264% |
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