🚀 挪威語Wav2Vec2模型 - 1B尼諾斯克語
該模型基於Facebook/Meta的特徵提取器 XLS-R 進行微調。微調後的模型在測試集上使用5-gram KenLM取得了以下結果(括號內為未使用語言模型的結果):
- 字錯率(WER): 0.1132 (0.1364)
- 字符錯誤率(CER): 0.0402 (---)
🚀 快速開始
本模型是基於Facebook/Meta的特徵提取器 XLS-R 微調得到的。若要復現這些結果,強烈建議按照 🤗 的說明 訓練一個簡單的瑞典語模型。驗證能夠完成此操作後,創建一個全新的倉庫,然後從本倉庫複製文件 run.sh
和 run_speech_recognition_ctc.py
開始。運行這些文件將創建所有其他必要的文件,應該可以復現我們的結果。通過對超參數進行一些調整,甚至有可能構建出更好的自動語音識別(ASR)模型。
✨ 主要特性
- 本模型是團隊在 🤗 主辦的 穩健語音事件 期間創建的多個Wav2Vec模型之一。
- 微調後的模型在測試集上使用5-gram KenLM取得了較好的字錯率(WER)和字符錯誤率(CER)。
- 增加一個簡單的5-gram語言模型可以提高模型的識別結果。
📦 安裝指南
文檔未提供具體安裝步驟,故跳過此章節。
💻 使用示例
文檔未提供代碼示例,故跳過此章節。
📚 詳細文檔
模型描述
這是團隊在 🤗 主辦的 穩健語音事件 期間創建的多個Wav2Vec模型之一。以下是我們模型的完整列表及其最終得分:
數據集
在活動進行的同時,團隊還將 挪威議會語音語料庫(NPSC) 轉換為 🤗 數據集格式的 NbAiLab/NPSC,並將其用作訓練的主要來源。
團隊
以下人員為構建此模型做出了貢獻:Rolv - Arild Braaten、Javier de la Rosa和Freddy Wetjen。
訓練過程
語言模型
如得分所示,添加一個簡單的5-gram語言模型將提高識別結果。🤗 提供了另一篇 非常不錯的博客,解釋瞭如何添加5-gram語言模型來改進ASR模型。可以從自己的語料庫構建這個模型,例如從 挪威巨型語料庫 中提取一些合適的文本。也可以跳過指南中的一些步驟,並從 本倉庫複製5-gram模型。
參數
最終模型使用以下參數運行:
--dataset_name="NbAiLab/NPSC"
--model_name_or_path="facebook/wav2vec2-xls-r-1b"
--dataset_config_name="16K_mp3_nynorsk"
--output_dir="./"
--overwrite_output_dir
--num_train_epochs="40"
--per_device_train_batch_size="12"
--per_device_eval_batch_size="12"
--gradient_accumulation_steps="2"
--learning_rate="2e-5"
--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"
--ctc_zero_infinity=True
--use_auth_token
--seed="42"
--fp16
--group_by_length
--do_train --do_eval
--push_to_hub
--preprocessing_num_workers="16"
使用這些設置,在普通GPU上訓練可能需要3 - 4天。不過,通過調整這些參數,可以獲得一個不錯的模型並加快訓練結果。
參數 |
說明 |
per_device_train_batch_size |
將此參數調整為可用內存的最大值。根據系統情況,16或24可能是不錯的設置 |
gradient_accumulation_steps |
可以進一步向上調整,以增加批量大小並加快訓練速度,而不會出現內存問題 |
learning_rate |
可以提高,可能高達1e - 4。加快訓練速度,但可能會增加不穩定性 |
epochs |
可以顯著減少。這是一個非常大的數據集,經過幾個epoch可能已經能得到不錯的結果 |
🔧 技術細節
文檔未提供足夠的技術實現細節(具體技術說明少於50字),故跳過此章節。
📄 許可證
本模型使用Apache - 2.0許可證。
📚 引用
@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