🚀 Wav2vec 2.0 large VoxRex Swedish (C)
这是基于KB的VoxRex large模型的微调版本,使用了瑞典广播、NST和Common Voice的数据进行微调。在不使用语言模型的情况下进行评估,结果如下:NST + Common Voice测试集(占总句子的2%)的字错率(WER)为2.5%。Common Voice测试集的直接字错率为8.49%,使用4-gram语言模型时为7.37%。
使用此模型时,请确保您的语音输入采样率为16kHz。
2022年1月10日更新:更新到VoxRex - C版本。
2022年5月16日更新:相关论文可查看此处。
✨ 主要特性
- 微调优化:基于特定的瑞典语数据对模型进行微调,提升在瑞典语语音识别任务上的性能。
- 多数据集支持:使用了Common Voice、NST_Swedish_ASR_Database和P4等多个数据集进行训练。
- 评估指标明确:使用字错率(WER)作为评估指标,方便衡量模型性能。
📦 安装指南
文档未提及具体安装步骤,故跳过此章节。
💻 使用示例
基础用法
import torch
import torchaudio
from datasets import load_dataset
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
test_dataset = load_dataset("common_voice", "sv-SE", split="test[:2%]")
processor = Wav2Vec2Processor.from_pretrained("KBLab/wav2vec2-large-voxrex-swedish")
model = Wav2Vec2ForCTC.from_pretrained("KBLab/wav2vec2-large-voxrex-swedish")
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])
📚 详细文档
性能表现

*图表展示的是未对Common Voice进行额外20k步微调时的性能
训练过程
此模型在NST + CommonVoice上进行了120000次更新的微调。之后仅在CommonVoice上进行了额外的20000次更新。在CommonVoice上的额外微调在一定程度上影响了NST + CommonVoice测试集的性能,不出所料地提升了CommonVoice测试集的性能。不过总体来看,它的表现似乎更好[需要引用]。

评估指标
属性 |
详情 |
模型类型 |
Wav2vec 2.0 large VoxRex Swedish (C) |
训练数据 |
common_voice、NST_Swedish_ASR_Database、P4 |
评估指标 |
字错率(WER) |
Common Voice测试集WER(无语言模型) |
8.49% |
Common Voice测试集WER(4 - gram语言模型) |
7.37% |
NST + Common Voice测试集WER |
2.5% |
引用信息
https://arxiv.org/abs/2205.03026
@misc{malmsten2022hearing,
title={Hearing voices at the National Library -- a speech corpus and acoustic model for the Swedish language},
author={Martin Malmsten and Chris Haffenden and Love Börjeson},
year={2022},
eprint={2205.03026},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
📄 许可证
该模型使用的许可证为cc0 - 1.0。