klaam
1.0.0
阿拉伯語語音識別,分類和文本到語音使用了許多高級模型,例如Wave2Vec和FastSpeech2。該存儲庫允許使用驗證的模型進行培訓和預測。
from klaam import SpeechClassification
model = SpeechClassification ()
model . classify ( wav_file ) from klaam import SpeechRecognition
model = SpeechRecognition ()
model . transcribe ( wav_file ) from klaam import TextToSpeech
prepare_tts_model_path = "../cfgs/FastSpeech2/config/Arabic/preprocess.yaml"
model_config_path = "../cfgs/FastSpeech2/config/Arabic/model.yaml"
train_config_path = "../cfgs/FastSpeech2/config/Arabic/train.yaml"
vocoder_config_path = "../cfgs/FastSpeech2/model_config/hifigan/config.json"
speaker_pre_trained_path = "../data/model_weights/hifigan/generator_universal.pth.tar"
model = TextToSpeech ( prepare_tts_model_path , model_config_path , train_config_path , vocoder_config_path , speaker_pre_trained_path )
model . synthesize ( sample_text )有兩種可識別現代標準阿拉伯語(MSA)和埃及方言(EGY)的可識別模型。您可以使用lang屬性設置其中的任何一個。
from klaam import SpeechRecognition
model = SpeechRecognition ( lang = 'msa' )
model . transcribe ( 'file.wav' )| 數據集 | 描述 | 關聯 |
|---|---|---|
| MGB-3 | 埃及阿拉伯語言語在野外識別。每個句子都由四個註釋者註釋。從YouTube收集了超過15個小時。 | 這裡[需要註冊] |
| adi-5 | 從Aljazeera電視收集了50多小時。 4區域方言:埃及(Egy),黎凡特(LAV),海灣(GLF),北非(NOR)和現代標準阿拉伯語(MSA)。該數據集是MGB-3挑戰的一部分。 | 這裡[需要註冊] |
| 常見的聲音 | 在擁抱面上可用的多語言數據集 | 這裡。 |
| 阿拉伯語語料庫 | 帶有對齊和轉錄的阿拉伯數據集 | 這裡。 |
我們的項目目前支持四種型號,其中三種是在變壓器上可用的。
| 語言 | 描述 | 來源 |
|---|---|---|
| 埃及人 | 語音識別 | WAV2VEC2-LARGE-XLSR-53-阿拉伯 - 埃及人 |
| 標準阿拉伯語 | 語音識別 | WAV2VEC2-LARGE-XLSR-53-阿拉伯語 |
| egy,nor,lav,glf,msa | 語音分類 | wav2Vec2-large-XLSR-dialect-classiencation |
| 標準阿拉伯語 | 文本到語音 | FastSpeech2 |
| 姓名 | 描述 | 筆記本 |
|---|---|---|
| 演示 | 分類,重新調整和文本到語音的代碼。 | |
| 與麥克風的演示 | 音頻重新配置和記錄分類。 |
這些腳本是JQUEGUINER/WAV2VEC2-SPRINT的修改。
此腳本用於5個類的分類任務。
python run_classifier.py
--model_name_or_path= " facebook/wav2vec2-large-xlsr-53 "
--output_dir=/path/to/output
--cache_dir=/path/to/cache/
--freeze_feature_extractor
--num_train_epochs= " 50 "
--per_device_train_batch_size= " 32 "
--preprocessing_num_workers= " 1 "
--learning_rate= " 3e-5 "
--warmup_steps= " 20 "
--evaluation_strategy= " steps "
--save_steps= " 100 "
--eval_steps= " 100 "
--save_total_limit= " 1 "
--logging_steps= " 100 "
--do_eval
--do_train 該腳本用於在數據集上進行培訓,以便在埃及方言數據集上進行預處理。
python run_mgb3.py
--model_name_or_path= " facebook/wav2vec2-large-xlsr-53 "
--output_dir=/path/to/output
--cache_dir=/path/to/cache/
--freeze_feature_extractor
--num_train_epochs= " 50 "
--per_device_train_batch_size= " 32 "
--preprocessing_num_workers= " 1 "
--learning_rate= " 3e-5 "
--warmup_steps= " 20 "
--evaluation_strategy= " steps "
--save_steps= " 100 "
--eval_steps= " 100 "
--save_total_limit= " 1 "
--logging_steps= " 100 "
--do_eval
--do_train 該腳本可用於阿拉伯語通用語音培訓
python run_common_voice.py
--model_name_or_path= " facebook/wav2vec2-large-xlsr-53 "
--dataset_config_name= " ar "
--output_dir=/path/to/output/
--cache_dir=/path/to/cache
--overwrite_output_dir
--num_train_epochs= " 1 "
--per_device_train_batch_size= " 32 "
--per_device_eval_batch_size= " 32 "
--evaluation_strategy= " steps "
--learning_rate= " 3e-4 "
--warmup_steps= " 500 "
--fp16
--freeze_feature_extractor
--save_steps= " 10 "
--eval_steps= " 10 "
--save_total_limit= " 1 "
--logging_steps= " 10 "
--group_by_length
--feat_proj_dropout= " 0.0 "
--layerdrop= " 0.1 "
--gradient_checkpointing
--do_train --do_eval
--max_train_samples 100 --max_val_samples 100我們使用Ming024的fastspeech2實現。
該過程如下:
wget http://en.arabicspeechcorpus.com/arabic-speech-corpus.zip
unzip arabic-speech-corpus.zip
mkdir -p raw_data/Arabic/Arabic preprocessed_data/Arabic/TextGrid/Arabic
cp arabic-speech-corpus/textgrid/* preprocessed_data/Arabic/TextGrid/Arabic
import os
base_dir = '/content/arabic-speech-corpus'
lines = []
for lab_file in os . listdir ( f' { base_dir } /lab' ):
lines . append ( lab_file [: - 4 ] + '|' + open ( f' { base_dir } /lab/ { lab_file } ' , 'r' ). read ())
open ( f' { base_dir } /metadata.csv' , 'w' ). write (( ' n ' ). join ( lines ))git clone --depth 1 https://github.com/zaidalyafeai/FastSpeech2
cd FastSpeech2
pip install -r requirements.txt python3 prepare_align.py config/Arabic/preprocess.yaml
python3 preprocess.py config/Arabic/preprocess.yaml
unzip hifigan/generator_LJSpeech.pth.tar.zip -d hifigan
unzip hifigan/generator_universal.pth.tar.zip -d hifigan
python3 train.py -p config/Arabic/preprocess.yaml -m config/Arabic/model.yaml -t config/Arabic/train.yaml
該存儲庫是由ARBML團隊創建的。如果您有任何建議或貢獻,請隨時提出拉。