🚀 加泰罗尼亚语Wav2Vec2大模型
本模型基于facebook/wav2vec2-large-100k-voxpopuli,使用Common Voice和ParlamentParla数据集对加泰罗尼亚语进行了微调。它可用于语音识别任务,将语音转换为文本,在加泰罗尼亚语语音处理方面具有较高的准确性和实用性。
🚀 快速开始
本模型基于facebook/wav2vec2-large-100k-voxpopuli,使用Common Voice和ParlamentParla数据集对加泰罗尼亚语进行了微调。
⚠️ 重要提示
- 所使用的训练/开发/测试拆分并不完全与CommonVoice 6.1数据集对应。使用了自定义拆分,结合了CommonVoice和ParlamentParla数据集,可在此处找到。在CV测试数据集上进行评估会产生有偏差的字错率(WER),因为该数据集中的1144个音频文件已用于此模型的训练/评估。
- 字错率(WER)是使用test.csv计算的,该数据集在模型训练/评估期间未被模型见过。
你可以在GitHub仓库ccoreilly/wav2vec2-catala中找到训练和评估脚本。
使用此模型时,请确保你的语音输入采样率为16kHz。
✨ 主要特性
- 多数据集微调:使用Common Voice和ParlamentParla数据集对加泰罗尼亚语进行微调,提升模型在加泰罗尼亚语语音识别上的性能。
- 高精度识别:在多个测试数据集上取得了较低的字错率(WER),证明了模型的准确性。
📦 安装指南
文档未提及安装相关内容,故跳过。
💻 使用示例
基础用法
import torch
import torchaudio
from datasets import load_dataset
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
test_dataset = load_dataset("common_voice", "ca", split="test[:2%]")
processor = Wav2Vec2Processor.from_pretrained("ccoreilly/wav2vec2-large-100k-voxpopuli-catala")
model = Wav2Vec2ForCTC.from_pretrained("ccoreilly/wav2vec2-large-100k-voxpopuli-catala")
resampler = torchaudio.transforms.Resample(48_000, 16_000)
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])
高级用法
文档未提及高级用法相关代码,故跳过。
📚 详细文档
模型信息
属性 |
详情 |
模型类型 |
加泰罗尼亚语Wav2Vec2大模型 |
训练数据 |
Common Voice、ParlamentParla |
许可证 |
Apache-2.0 |
评估结果
模型在以下未被模型见过的数据集上评估了字错率(WER):
🔧 技术细节
文档未提及技术细节相关内容,故跳过。
📄 许可证
本模型使用的许可证为Apache-2.0。