Ce projet travaille toujours sur les progrès. Pour améliorer Funcodec, faites-moi savoir vos préoccupations et n'hésitez pas à les commenter dans la partie Issues .
egs/LibriTTS/text2speech_laura/README.md pour plus de détails. git clone https://github.com/alibaba/FunCodec.git && cd FunCodec
pip install --editable ./? Liens vers le HuggingFace Model Hub, tandis que fait référence à Modelcope.
| Nom du modèle | Moyeu modèle | Corpus | Débit | Paramètres | Flops |
|---|---|---|---|---|---|
| Audio_Codec-Encodec-Zh_en-General-16K-NQ32DS640-PYTORCH | ? | Général | 250 ~ 8000 | 57,83 m | 7,73 g |
| Audio_Codec-Encodec-Zh_en-General-16k-NQ32DS320-PYTORCH | ? | Général | 500 ~ 16000 | 14,85 m | 3,72 g |
| Audio_codec-encodec-en-libritts-16k-nq32ds640-pytorch | ? | Bilans | 250 ~ 8000 | 57,83 m | 7,73 g |
| Audio_Codec-Encodec-en-Libritts-16k-NQ32DS320-PYTORCH | ? | Bilans | 500 ~ 16000 | 14,85 m | 3,72 g |
| Audio_Codec-FreqCodec_Magphase-en-Libritts-16k-Gr8nq32ds320-Pytorch | ? | Bilans | 500 ~ 16000 | 4,50 m | 2,18 g |
| Audio_Codec-FreqCodec_Magphase-en-Libritts-16k-Gr1nq32ds320-Pytorch | ? | Bilans | 500 ~ 16000 | 0,52 m | 0,34 g |
Veuillez référer egs/LibriTTS/codec/encoding_decoding.sh pour télécharger des modèles pré-étendus:
cd egs/LibriTTS/codec
model_name=audio_codec-encodec-zh_en-general-16k-nq32ds640-pytorch
bash encoding_decoding.sh --stage 0 --model_name ${model_name} --model_hub modelscope
# The pre-trained model will be downloaded to exp/audio_codec-encodec-zh_en-general-16k-nq32ds640-pytorch Veuillez référer egs/LibriTTS/codec/encoding_decoding.sh pour télécharger des modèles pré-étendus:
cd egs/LibriTTS/codec
model_name=audio_codec-encodec-zh_en-general-16k-nq32ds640-pytorch
bash encoding_decoding.sh --stage 0 --model_name ${model_name} --model_hub huggingface
# The pre-trained model will be downloaded to exp/audio_codec-encodec-zh_en-general-16k-nq32ds640-pytorch Veuillez référer egs/LibriTTS/codec/encoding_decoding.sh pour effectuer un codage et un décodage. Extraire les codes avec un fichier d'entrée input_wav.scp , et les codes seront enregistrés sur output_dir/codecs.txt dans un format de JSONL.
cd egs/LibriTTS/codec
bash encoding_decoding.sh --stage 1 --batch_size 16 --num_workers 4 --gpu_devices " 0,1 "
--model_dir exp/ ${model_name} --bit_width 16000
--wav_scp input_wav.scp --out_dir outputs/codecs/
# input_wav.scp has the following format:
# uttid1 path/to/file1.wav
# uttid2 path/to/file2.wav
# ... Decode codes avec un fichier d'entrée codecs.txt , et la forme d'onde reconstruite sera enregistrée sur output_dir/logdir/output.*/*.wav .
bash encoding_decoding.sh --stage 2 --batch_size 16 --num_workers 4 --gpu_devices " 0,1 "
--model_dir exp/ ${model_name} --bit_width 16000 --file_sampling_rate 16000
--wav_scp codecs.txt --out_dir outputs/recon_wavs
# codecs.scp is the output of above encoding stage, which has the following format:
# uttid1 [[[1, 2, 3, ...],[2, 3, 4, ...], ...]]
# uttid2 [[[9, 7, 5, ...],[3, 1, 2, ...], ...]] Pour les corpus open-source couramment utilisés, vous pouvez former un modèle en utilisant la recette dans le répertoire egs . Par exemple, pour former un modèle sur le Corpus LibriTTS , vous pouvez utiliser egs/LibriTTS/codec/run.sh :
# entry the LibriTTS recipe directory
cd egs/LibriTTS/codec
# run data downloading, preparation and training stages with 2 GPUs (device 0 and 1)
bash run.sh --stage 0 --stop_stage 3 --gpu_devices 0,1 --gpu_num 2Nous recommandons d'exécuter le script étage par étape pour avoir un aperçu de FunCodec.
Pour les corps découverts ou l'ensemble de données personnalisés, vous pouvez préparer les données par vous-même. En général, Funcodec utilise le fichier wav.scp -type Kaldi pour organiser les fichiers de données. wav.scp a le format suivant:
# for waveform files
uttid1 /path/to/uttid1.wav
uttid2 /path/to/uttid2.wav
# for kaldi-ark files
uttid3 /path/to/ark1.wav:10
uttid4 /path/to/ark1.wav:200
uttid5 /path/to/ark2.wav:10 Comme indiqué dans l'exemple ci-dessus, FunCodec prend en charge la combinaison de Formes d'onde ou de fichiers Kaldi-Ark dans un fichier wav.scp pour la formation et l'inférence. Voici un script de démonstration pour former un modèle sur votre ensemble de données personnalisé nommé foo :
cd egs/LibriTTS/codec
# 0. make the directory for train, dev and test sets
mkdir -p dump/foo/train dump/foo/dev dump/foo/test
# 1a. if you already have the wav.scp file, just place them under the corresponding directories
mv train.scp dump/foo/train/ ; mv dev.scp dump/foo/dev/ ; mv test.scp dump/foo/test/ ;
# 1b. if you don't have the wav.scp file, you can prepare it as follows
find path/to/train_set/ -iname " *.wav " | awk -F ' / ' ' {print $(NF),$0} ' | sort > dump/foo/train/wav.scp
find path/to/dev_set/ -iname " *.wav " | awk -F ' / ' ' {print $(NF),$0} ' | sort > dump/foo/dev/wav.scp
find path/to/test_set/ -iname " *.wav " | awk -F ' / ' ' {print $(NF),$0} ' | sort > dump/foo/test/wav.scp
# 2. collate shape files
mkdir exp/foo_states/train exp/foo_states/dev
torchrun --nproc_per_node=4 --master_port=1234 scripts/gen_wav_length.py --wav_scp dump/foo/train/wav.scp --out_dir exp/foo_states/train/wav_length
cat exp/foo_states/train/wav_length/wav_length. * .txt | shuf > exp/foo_states/train/speech_shape
torchrun --nproc_per_node=4 --master_port=1234 scripts/gen_wav_length.py --wav_scp dump/foo/dev/wav.scp --out_dir exp/foo_states/dev/wav_length
cat exp/foo_states/dev/wav_length/wav_length. * .txt | shuf > exp/foo_states/dev/speech_shape
# 3. train the model with 2 GPUs (device 4 and 5) on the customized dataset (foo)
bash run.sh --gpu_devices 4,5 --gpu_num 2 --dumpdir dump/foo --state_dir foo_statesCe projet est autorisé sous la licence du MIT. FunCodec contient également divers composants tiers et un code modifié à partir d'autres reposs sous d'autres licences open source.
@misc { du2023funcodec ,
title = { FunCodec: A Fundamental, Reproducible and Integrable Open-source Toolkit for Neural Speech Codec } ,
author = { Zhihao Du, Shiliang Zhang, Kai Hu, Siqi Zheng } ,
year = { 2023 } ,
eprint = { 2309.07405 } ,
archivePrefix = { arXiv } ,
primaryClass = { cs.Sound }
}