YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

ML_TTS_Dataset

Pipeline

  • 可以直接执行第5,6步。
  1. 文件重命名
    • ML_TTS_Dataset/examples/bash/rename/run_single_split.sh
  2. Convert to 16kHZ
    • bash ML_TTS_Dataset/examples/bash/resample/run_single_dir.sh 指定输出的音频格式和采样率
    • 当音频格式为.ogg时,python虽然能读入.ogg文件,但速度会很慢。可以先跑这个脚本把.ogg转换为.wav。
  3. 检查静音区,设置阈值去除带背景声视频
    • bash ML_TTS_Dataset/examples/bash/noise_suppression/run_single_dir_with_audio_root.sh 可跳过第2步,直接到第3步,不需要额外的转换采样率。
  4. 多说话人检测,抛弃掉多说话人的音频。
    • bash ML_TTS_Dataset/examples/bash/speaker_diarization/run_audio_root.sh 多说话人检测已经与ASR (WhisperX)融合。
  5. ASR (WhisperX)
    • bash ML_TTS_Dataset/examples/bash/asr_whisperx/run_demo.sh
  6. DNSMOS评测
    • bash ML_TTS_Dataset/examples/bash/dns_mos/dns_mos_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 LD_LIBRARY_PATH=/home/lwx1339650/opt/anaconda3/envs/cuda12/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=/home/lwx1339650/opt/anaconda3/envs/cuda12/lib echo $LD_LIBRARY_PATH
  • 本机的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: ML_TTS_Dataset/external/whisperX

checkpoint路径

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

ASR (WhisperX)参数

以ML_TTS_Dataset/examples/bash/asr_whisperx/run_demo.sh为例,各参数解释如下:

  • model_type=whisperx 使用whisperx模型。目前支持的模型:fasterwhisper,whisperx

  • model_dir=/mnt/northcn3/cbu-tts/checkpoint/faster_whisper/faster-whisper-large-v3 模型的文件夹路径

  • model_size=large-v3 与model_dir匹配

  • lang2align_model_yaml_path=/mnt/yuyin1/cbu-tts/model/ML_TTS_Dataset/examples/bash/asr_whisperx/lang2align_model.yaml 使用wav2vec2系列模型做对齐时的配置文件,yaml格式。 yaml示例: zh: model_name: hf_wav2vec2 model_dir: /mnt/yuyin1/cbu-tts/checkpoint/wav2vec2/jonatasgrosman--wav2vec2-large-xlsr-53-chinese-zh-cn pipeline_type: huggingface interval: 0.85 confidence: 0.95 其中每项参数的含义: zh: 语言 model_name:只支持hf_wav2vec2 model_dir: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 过滤语言时,只保留英语,中文。

  • vad_model_path=/mnt/yuyin1/cbu-tts/checkpoint/whisperx/vad/pytorch_model.bin vad_model模型的路径

  • diarize_model_path=/mnt/yuyin1/cbu-tts/checkpoint/pyannote/speaker-diarization-3.1/config.yaml diarize_model模型的路径。在checkpoint/pyannote/speaker-diarization-3.1/config.yaml中,需要做如下修改: embedding的路径改成checkpoint/pyannote/wespeaker-voxceleb-resnet34-LM/pytorch_model.bin segmentation的路径改成checkpoint/pyannote/segmentation-3.0/pytorch_model.bin

  • dns_model_dir=/mnt/yuyin1/cbu-tts/checkpoint/DNSMOS/DNSMOS DNSMOS模型的文件夹

  • dns_mos_threshold=3.8 当DNSMOS的评测分数小于3.8时,会过滤掉这条语音。 建议3.8+

  • precision=float16 可选int8,float16等量化方式加载whisperx模型

  • task=transcribe 让whisperx执行转录任务。

  • initial_prompt=以下是一段语音记录。 英语的transcript默认带有标点符号,而中文的没有。 加入这个initial_prompt后,中文的transcript也会有语音。

  • target_sr=16000 输入到whisperx模型的采样率为16000

  • target_format=wav 输入到whisperx模型的音频格式为16000

  • audio_clip_backend=moivepy 使用moivepy来剪辑和保存音频。

  • device=cuda 使用cuda。可选参数:cpu,cuda

  • gpu_list=1,2,3 使用gpu id为1,2,3的卡。(gpu id从0开始计数)

  • input_audio_root=/mnt/yuyin1/cbu-tts/data_process/demo/noise_suppression 输入的音频文件夹路径

  • output_root=/mnt/yuyin1/cbu-tts/data_process/demo/asr 输出的音频文件夹路径。其输出的目录结构与input_audio_root相同。

  • error_log_dir=/mnt/yuyin1/cbu-tts/data_process/demo/log/asr 日志文件夹的路径。

  • test_times=-1 测试的音频文件数量。当test_times为正数数,处理test_times条音频。当test_times为负数时,处理所有音频。

  • n_process=3 一共运行的进程数量。

  • Q:如何在单卡上跑4个进程来处理数据?

  • A:gpu_list=0,n_process=4

  • --suppress_numerals 将中文数字转换为阿拉伯数字。

  • --filter_by_aligned_model 与lang2align_model_yaml_path搭配使用。使用wav2vec2模型检测word,并使用他来过滤低置信度的语音。

代码同步

  • 备份代码 bash /mnt/yuyin1/cbu-tts/model/ML_TTS_Dataset/examples/bash/bac.sh tar -czf ML_TTS_Dataset.tar.gz ML_TTS_Dataset --exclude .git
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support