CoolFace
Modelpublic

Wenrui/ML_TTS_Dataset

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
Model Card

MLTTSDataset

Pipeline

  • —可以直接执行第5,6步。
  • —文件重命名
  • —MLTTSDataset/examples/bash/rename/runsinglesplit.sh
  • —Convert to 16kHZ
  • —bash MLTTSDataset/examples/bash/resample/runsingledir.sh 指定输出的音频格式和采样率
  • —当音频格式为.ogg时,python虽然能读入.ogg文件,但速度会很慢。可以先跑这个脚本把.ogg转换为.wav。
  • —检查静音区,设置阈值去除带背景声视频
  • —bash MLTTSDataset/examples/bash/noisesuppression/runsingledirwithaudioroot.sh 可跳过第2步,直接到第3步,不需要额外的转换采样率。
  • —多说话人检测,抛弃掉多说话人的音频。
  • —bash MLTTSDataset/examples/bash/speakerdiarization/runaudio_root.sh 多说话人检测已经与ASR (WhisperX)融合。
  • —ASR (WhisperX)
  • —bash MLTTSDataset/examples/bash/asrwhisperx/rundemo.sh
  • —DNSMOS评测
  • —bash MLTTSDataset/examples/bash/dnsmos/dnsmos_local.sh

ASR (WhisperX)安装

  • —WhisperX依赖于pyannote.audio的vad模型,这个要求编译torch时的cuDNN版本跟当前环境的cuDNN版本相同。当本机中cuDNN版本为8.9.2时,在conda中安装 conda install cudnn=8.9.2 -y
  • —修改环境变量,添加cuDNN库的路径。 export LDLIBRARYPATH=/home/lwx1339650/opt/anaconda3/envs/cuda12/lib:$LDLIBRARYPATH export LDLIBRARYPATH=/home/lwx1339650/opt/anaconda3/envs/cuda12/lib echo $LDLIBRARYPATH
  • —本机的cudnn版本为8.5.0,安装cuda 11.8对应的torch,此时torch对应cudnn8.5.0
  • —安装faster-whisper会将torch更新至2.4.0, 此时需要降级安装torch和faster-whisper依赖的推理框架ctranslate. pip uninstall nvidia-cudnn-cu12 nvidia-nccl-cu12 conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 cudatoolkit=11.8 -c pytorch -c nvidia pip install --force-reinstall ctranslate2==3.24.0 pip uninstall numpy pip install numpy==1.23.5
  • —安装这个路径下的WhisperX: MLTTSDataset/external/whisperX

checkpoint路径

https://onebox.huawei.com/p/1d76d18f71882550c9a53702ec983565 确实的checkpoint也可以从huggingface下载。

ASR (WhisperX)参数

以MLTTSDataset/examples/bash/asrwhisperx/rundemo.sh为例,各参数解释如下:

  • —model_type=whisperx 使用whisperx模型。目前支持的模型:fasterwhisper,whisperx
  • —modeldir=/mnt/northcn3/cbu-tts/checkpoint/fasterwhisper/faster-whisper-large-v3 模型的文件夹路径
  • —modelsize=large-v3 与modeldir匹配
  • —lang2alignmodelyamlpath=/mnt/yuyin1/cbu-tts/model/MLTTSDataset/examples/bash/asrwhisperx/lang2alignmodel.yaml 使用wav2vec2系列模型做对齐时的配置文件,yaml格式。 yaml示例: zh: modelname: hfwav2vec2 modeldir: /mnt/yuyin1/cbu-tts/checkpoint/wav2vec2/jonatasgrosman--wav2vec2-large-xlsr-53-chinese-zh-cn pipelinetype: huggingface interval: 0.85 confidence: 0.95 其中每项参数的含义: zh: 语言 modelname:只支持hfwav2vec2 modeldir:huggingface格式的wav2vec2 中文wav2vec2模型:checkpoint/wav2vec2/jonatasgrosman--wav2vec2-large-xlsr-53-chinese-zh-cn 中文的也可以从这里下载:https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-chinese-zh-cn/tree/main 英语wav2vec2模型:https://huggingface.co/facebook/wav2vec2-base-960h pipeline_type: 只支持huggingface interval:每个word之间的间隔。小于这个间隔的语音会被筛掉。 confidence:每个word的置信度。小于这个置信度的语音会被筛掉。
  • —available_langs=en,zh 过滤语言时,只保留英语,中文。
  • —vadmodelpath=/mnt/yuyin1/cbu-tts/checkpoint/whisperx/vad/pytorchmodel.bin vadmodel模型的路径
  • —diarizemodelpath=/mnt/yuyin1/cbu-tts/checkpoint/pyannote/speaker-diarization-3.1/config.yaml diarizemodel模型的路径。在checkpoint/pyannote/speaker-diarization-3.1/config.yaml中,需要做如下修改: embedding的路径改成checkpoint/pyannote/wespeaker-voxceleb-resnet34-LM/pytorchmodel.bin segmentation的路径改成checkpoint/pyannote/segmentation-3.0/pytorch_model.bin
  • —dnsmodeldir=/mnt/yuyin1/cbu-tts/checkpoint/DNSMOS/DNSMOS DNSMOS模型的文件夹
  • —dnsmosthreshold=3.8 当DNSMOS的评测分数小于3.8时,会过滤掉这条语音。 建议3.8+
  • —precision=float16 可选int8,float16等量化方式加载whisperx模型
  • —task=transcribe 让whisperx执行转录任务。
  • —initialprompt=以下是一段语音记录。 英语的transcript默认带有标点符号,而中文的没有。 加入这个initialprompt后,中文的transcript也会有语音。
  • —target_sr=16000 输入到whisperx模型的采样率为16000
  • —target_format=wav 输入到whisperx模型的音频格式为16000
  • —audioclipbackend=moivepy 使用moivepy来剪辑和保存音频。
  • —device=cuda 使用cuda。可选参数:cpu,cuda
  • —gpu_list=1,2,3 使用gpu id为1,2,3的卡。(gpu id从0开始计数)
  • —inputaudioroot=/mnt/yuyin1/cbu-tts/dataprocess/demo/noisesuppression 输入的音频文件夹路径
  • —outputroot=/mnt/yuyin1/cbu-tts/dataprocess/demo/asr 输出的音频文件夹路径。其输出的目录结构与inputaudioroot相同。
  • —errorlogdir=/mnt/yuyin1/cbu-tts/data_process/demo/log/asr 日志文件夹的路径。
  • —testtimes=-1 测试的音频文件数量。当testtimes为正数数,处理testtimes条音频。当testtimes为负数时,处理所有音频。
  • —n_process=3 一共运行的进程数量。
  • —Q:如何在单卡上跑4个进程来处理数据?
  • —A:gpulist=0,nprocess=4
  • —--suppress_numerals 将中文数字转换为阿拉伯数字。
  • —--filterbyalignedmodel 与lang2alignmodelyamlpath搭配使用。使用wav2vec2模型检测word,并使用他来过滤低置信度的语音。

代码同步

  • —备份代码 bash /mnt/yuyin1/cbu-tts/model/MLTTSDataset/examples/bash/bac.sh tar -czf MLTTSDataset.tar.gz MLTTSDataset --exclude .git