🚀 挪威语Wav2Vec2模型 - 300M - VoxRex - 新挪威语
本模型在瑞典国家图书馆的特征提取器 VoxRex-model 基础上进行微调。微调后的模型在测试集上结合5-gram KenLM取得了以下结果(括号内为未使用语言模型的结果):
- 字错率(WER):0.1222 (0.1537)
- 字符错误率(CER):0.0419 (0.0468)
✨ 主要特性
本模型是我们团队在🤗举办的 鲁棒语音事件 期间创建的多个Wav2Vec模型之一。以下是我们模型的完整列表及其最终得分:
数据集
在活动期间,团队还将 挪威议会演讲语料库(NPSC) 转换为🤗数据集格式的 NbAiLab/NPSC,并将其作为训练的主要来源。
🚀 快速开始
我们已发布了活动期间开发的所有代码,以便挪威自然语言处理社区在开发更好的挪威语自动语音识别模型时可以基于此进行构建。这些模型的微调对计算资源的要求不是很高。按照以下说明操作后,使用普通GPU,您应该能够在不到一天的时间内训练出自己的自动语音识别系统。
📚 详细文档
团队
以下人员为构建此模型做出了贡献:Rolv - Arild Braaten、Per Egil Kummervold、Andre Kåsen、Javier de la Rosa、Per Erik Solberg 和 Freddy Wetjen。
训练过程
为了复现这些结果,我们强烈建议您遵循 🤗的说明 来训练一个简单的瑞典语模型。
当您确认可以完成此操作后,创建一个全新的仓库。然后,您可以从我们的仓库中复制文件 run.sh
和 run_speech_recognition_ctc.py
。运行这些文件将创建所有其他必要的文件,并使您能够复现我们的结果。通过对超参数进行一些调整,您甚至可能构建出更好的自动语音识别模型。祝您好运!
语言模型
正如得分所示,即使添加一个简单的5-gram语言模型也会改善结果。🤗提供了另一篇 非常不错的博客,解释了如何添加5-gram语言模型来改进自动语音识别模型。您可以从自己的语料库构建这个模型,例如从 挪威巨型语料库 中提取一些合适的文本。您也可以跳过指南中的一些步骤,并从 本仓库复制5-gram模型。
参数
最终模型使用以下参数运行:
--dataset_name="NbAiLab/NPSC"
--model_name_or_path="KBLab/wav2vec2-large-voxrex"
--dataset_config_name="16K_mp3_nynorsk"
--output_dir="./"
--overwrite_output_dir
--num_train_epochs="80"
--per_device_train_batch_size="16"
--per_device_eval_batch_size="16"
--gradient_accumulation_steps="2"
--learning_rate="1e-4"
--warmup_steps="2000"
--length_column_name="input_length"
--evaluation_strategy="steps"
--text_column_name="text"
--save_steps="500"
--eval_steps="500"
--logging_steps="100"
--layerdrop="0.041"
--attention_dropout="0.094"
--activation_dropout="0.055"
--hidden_dropout="0.047"
--save_total_limit="3"
--freeze_feature_encoder
--feat_proj_dropout="0.04"
--mask_time_prob="0.082"
--mask_time_length="10"
--mask_feature_prob="0.25"
--mask_feature_length="64"
--gradient_checkpointing
--min_duration_in_seconds="0.5"
--max_duration_in_seconds="30.0"
--use_auth_token
--seed="42"
--fp16
--group_by_length
--do_train --do_eval
--push_to_hub
--preprocessing_num_workers="32"
使用这些设置,在普通GPU上训练可能需要3 - 4天。但是,通过调整这些参数,您可以更快地得到一个不错的模型。
参数 |
说明 |
per_device_train_batch_size |
将此参数调整到可用内存的最大值。根据您的系统,16或24可能是不错的设置 |
gradient_accumulation_steps |
可以进一步向上调整以增加批量大小并加快训练速度,而不会出现内存问题 |
learning_rate |
可以提高,可能高达1e - 4。这会加快训练速度,但可能会增加不稳定性 |
epochs |
可以显著减少。这是一个非常大的数据集,经过几个epoch后您可能已经能得到不错的结果 |
引用
@inproceedings{de-la-rosa-etal-2023-boosting,
title = "Boosting {N}orwegian Automatic Speech Recognition",
author = "De La Rosa, Javier and
Braaten, Rolv-Arild and
Kummervold, Per and
Wetjen, Freddy",
booktitle = "Proceedings of the 24th Nordic Conference on Computational Linguistics (NoDaLiDa)",
month = may,
year = "2023",
address = "T{\'o}rshavn, Faroe Islands",
publisher = "University of Tartu Library",
url = "https://aclanthology.org/2023.nodalida-1.55",
pages = "555--564",
abstract = "In this paper, we present several baselines for automatic speech recognition (ASR) models for the two official written languages in Norway: Bokm{\aa}l and Nynorsk. We compare the performance of models of varying sizes and pre-training approaches on multiple Norwegian speech datasets. Additionally, we measure the performance of these models against previous state-of-the-art ASR models, as well as on out-of-domain datasets. We improve the state of the art on the Norwegian Parliamentary Speech Corpus (NPSC) from a word error rate (WER) of 17.10{\%} to 7.60{\%}, with models achieving 5.81{\%} for Bokm{\aa}l and 11.54{\%} for Nynorsk. We also discuss the challenges and potential solutions for further improving ASR models for Norwegian.",
}
详见 https://arxiv.org/abs/2307.01672
📄 许可证
本项目采用Apache - 2.0许可证。