
语音信息分层建模与零样本文本转语音的统一框架
USLM是基于SpeechTokenizer构建的统一语音语言模型,结合自回归和非自回归模型实现语音信息的分层建模。该开源项目提供完整的安装指南、预训练模型和零样本文本转语音推理流程。USLM在LibriTTS数据集上训练,展示了语音内容和副语言信息建模的能力,为语音处理研究提供新思路。
<a href='https://0nutation.github.io/SpeechTokenizer.github.io/'><img src='https://img.shields.io/badge/项目-主页-Green'></a> <a href='https://arxiv.org/abs/2308.16692'><img src='https://img.shields.io/badge/论文-Arxiv-red'></a>
USLM基于SpeechTokenizer构建,包含自回归和非自回归模型,可以分层建模语音中的信息。自回归(AR)模型通过对第一个RVQ量化器的标记进行建模来捕捉内容信息。非自回归(NAR)模型通过基于第一层标记生成后续量化器的标记来为AR模型补充副语言信息。
<br> <p align="center"> <img src="https://yellow-cdn.veclightyear.com/835a84d5/d131cb99-4d49-4d5f-998c-35bdebe15f04.png" width="95%"> <br> 概览 </p>按照以下步骤快速开始:
# PyTorch
pip install torch==1.13.1 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116
pip install torchmetrics==0.11.1
# fbank
pip install librosa==0.8.1
# phonemizer pypinyin
apt-get install espeak-ng
## OSX: brew install espeak
pip install phonemizer==3.2.1 pypinyin==0.48.0
# lhotse更新至最新版本
# https://github.com/lhotse-speech/lhotse/pull/956
# https://github.com/lhotse-speech/lhotse/pull/960
pip uninstall lhotse
pip install git+https://github.com/lhotse-speech/lhotse
# k2
# 在https://huggingface.co/csukuangfj/k2找到正确版本
pip install https://huggingface.co/csukuangfj/k2/resolve/main/cuda/k2-1.23.4.dev20230224+cuda11.6.torch1.13.1-cp310-cp310-linux_x86_64.whl
# icefall
git clone https://github.com/k2-fsa/icefall
cd icefall
pip install -r requirements.txt
export PYTHONPATH=`pwd`/../icefall:$PYTHONPATH
echo "export PYTHONPATH=`pwd`/../icefall:\$PYTHONPATH" >> ~/.zshrc
echo "export PYTHONPATH=`pwd`/../icefall:\$PYTHONPATH" >> ~/.bashrc
cd -
source ~/.zshrc
#SpeechTokenizer
pip install -U speechtokenizer
# uslm
git clone https://github.com/0nutation/USLM
cd USLM
pip install -e .
此版本的USLM在LibriTTS数据集上训练,由于数据限制,性能可能不是最优的。
| 模型 | 数据集 | 描述 |
|---|---|---|
| USLM_libri | LibriTTS | 在LibriTTS数据集上训练的USLM |
下载预训练的SpeechTokenizer模型:
st_dir="ckpt/speechtokenizer/" mkdir -p ${st_dir} cd ${st_dir} wget "https://huggingface.co/fnlp/SpeechTokenizer/resolve/main/speechtokenizer_hubert_avg/SpeechTokenizer.pt" wget "https://huggingface.co/fnlp/SpeechTokenizer/resolve/main/speechtokenizer_hubert_avg/config.json" cd -
下载预训练的USLM模型:
uslm_dir="ckpt/uslm/" mkdir -p ${uslm_dir} cd ${uslm_dir} wget "https://huggingface.co/fnlp/USLM/resolve/main/USLM_libritts/USLM.pt" wget "https://huggingface.co/fnlp/USLM/resolve/main/USLM_libritts/unique_text_tokens.k2symbols" cd -
推理:
out_dir="output/" mkdir -p ${out_dir} python3 bin/infer.py --output-dir ${out_dir}/ \ --model-name uslm --norm-first true --add-prenet false \ --share-embedding true --norm-first true --add-prenet false \ --audio-extractor SpeechTokenizer \ --speechtokenizer-dir "${st_dir}" \ --checkpoint=${uslm_dir}/USLM.pt \ --text-tokens "${uslm_dir}/unique_text_tokens.k2symbols" \ --text-prompts "mr Soames was a tall, spare man, of a nervous and excitable temperament." \ --audio-prompts prompts/1580_141083_000002_000002.wav \ --text "Begin with the fundamental steps of the process. This will give you a solid foundation to build upon and boost your confidence. " \
或者你可以直接运行inference.sh
bash inference.sh
VALL-E:我们基于的代码库。
如果你在论文中使用了这个代码或结果,请引用我们的工作:
@misc{zhang2023speechtokenizer, title={SpeechTokenizer: Unified Speech Tokenizer for Speech Language Models}, author={Xin Zhang and Dong Zhang and Shimin Li and Yaqian Zhou and Xipeng Qiu}, year={2023}, eprint={2308.16692}, archivePrefix={arXiv}, primaryClass={cs.CL} }


职场AI,就用扣子
AI办公助手,复杂任务高效处理。办公效率低?扣子空间AI助手支持播客生成、PPT制作、网页开发及报告写作,覆盖科研、商业、舆情等领域的专家Agent 7x24小时响应,生活工作无缝切换,提升50%效率!


多风格AI绘画神器
堆友平台由阿里巴巴设计团队创建,作为一款AI驱动的设计工具,专为设计师提供一站式增长服务。功能覆盖海量3D素材、AI绘画、实时渲染以及专业抠图,显著提升设计品质和效率。平台不仅提供工具,还是一个促进创意交流和个人发展的空间,界面友好,适合所有级别的设计师和创意工作者。


零代码AI应用开发平台
零代码AI应用开发平台,用户只需一句话简单描述需求,AI能自动生成小程序、APP或H5网页应用,无需编写代码。

