klaam
1.0.0
Arabic Speectの認識、分類、および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)を扱う認識のための2つの熱心なモデルがあります。 lang属性を使用してそれらのいずれかを設定できます。
from klaam import SpeechRecognition
model = SpeechRecognition ( lang = 'msa' )
model . transcribe ( 'file.wav' )| データセット | 説明 | リンク |
|---|---|---|
| MGB-3 | 野生でのエジプトのアラビア語の音声認識。すべての文に4つのアノテーターが注釈されました。 YouTubeから15時間以上が収集されています。 | ここ[登録が必要] |
| ADI-5 | Aljazeera TVから50時間以上収集されました。 4地域の方言:エジプト(EGY)、レバンティン(LAV)、湾岸(GLF)、北アフリカ(NOR)、および現代標準アラビア語(MSA)。このデータセットは、MGB-3チャレンジの一部です。 | ここ[登録が必要] |
| 一般的な声 | Huggingfaceでマルチリンギャルデータセットを利用できます | ここ。 |
| アラビア語の音声コーパス | アラインメントと転写を備えたアラビア語のデータセット | ここ。 |
私たちのプロジェクトは現在、4つのモデルをサポートしていますが、そのうち3つはトランスで魅力的です。
| 言語 | 説明 | ソース |
|---|---|---|
| エジプト人 | 音声認識 | WAV2VEC2-LARGE-XLSR-53-ARABIC-EGYPTIAN |
| 標準的なアラビア語 | 音声認識 | WAV2VEC2-LARGE-XLSR-53-ARABIC |
| egy、nor、lav、glf、msa | 音声分類 | WAV2VEC2-LARGE-XLSR-DIALECT-CLASSIFICATION |
| 標準的なアラビア語 | テキストからスピーチ | 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 このスクリプトは、egyption方言データセットで事前に削除するためのデータセットでトレーニングするためのものです。
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 100Ming024によるFastSpeech2のPytorch実装を使用します。
手順は次のとおりです。
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チームによって作成されました。提案や貢献がある場合は、お気軽にリクエストしてください。