🚀 挪威語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許可證。