【ModelScope】KAN-TTS搭建SAMBERT个性化语音合成开发环境

KAN-TTS搭建SAMBERT个性化语音合成开发环境

1、下载源码和预训练模型

1.1 安装Git 和 LFS支持

安装Git
sudo apt install git

Git LFS(Large File Storage, 大文件存储)
sudo apt-get install git-lfs
git lfs install

curl 16 Error:

error: RPC failed; curl 16 Error in the HTTP2 framing layer
fatal: expected flush after ref listing
  • 强制git使用HTTP 1.1
    git config --global http.version HTTP/1.1
  • 想要设置回HTTP2
    git config --global http.version HTTP/2

1.2 下载KAN-TTS源码

跳转到项目目录
cd ~/msai

msai是我的ai项目目录

下载源码并跳转到源码目录

git clone https://github.com/alibaba-damo-academy/KAN-TTS.git
cd KAN-TTS

1.3 下载预训练模型

git clone https://www.modelscope.cn/damo/speech_personal_sambert-hifigan_nsf_tts_zh-cn_pretrain_16k.git

2、配置conda安装源

2.1 查看conda源配置

conda config --show-sources

2.2 命令增加源

conda config --add channels https://pypi.tuna.tsinghua.edu.cn/simple

2.3 删除源配置

删除指定源
conda config --remove channels https://pypi.tuna.tsinghua.edu.cn/simple
删除所有自定义源 还原默认源
conda config --remove-key channels

2.4 直接编辑配置文件

sudo vim /home/你的用户名/.condarc

channels:
  - defaults
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
show_channel_urls: True

清理源索引缓存让新配置生效
conda clean -i

2.5 独立设置pip命令源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

Writing to /home/fb/.config/pip/pip.conf

3、创建开发环境

3.1 创建环境maas

创建名为maas的python开发环境
conda env create -f environment.yaml

3.2 遇到pytorch_wavelets 模块报错 GnuTLS recv error (-110)

原因是git版本使用了GnuTLS库,不是OpenSSL

Collecting git+https://github.com/fbcotter/pytorch_wavelets.git (from -r /mnt/d/develop/Ubuntu/kan-tts/condaenv.s5y8fuxa.requirements.txt (line 19))
  Cloning https://github.com/fbcotter/pytorch_wavelets.git to /tmp/pip-req-build-utwg371g

Pip subprocess error:
  Running command git clone --filter=blob:none --quiet https://github.com/fbcotter/pytorch_wavelets.git /tmp/pip-req-build-utwg371g
  fatal: unable to access 'https://github.com/fbcotter/pytorch_wavelets.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
  error: subprocess-exited-with-error

  × git clone --filter=blob:none --quiet https://github.com/fbcotter/pytorch_wavelets.git /tmp/pip-req-build-utwg371g did not run successfully.
  │ exit code: 128
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× git clone --filter=blob:none --quiet https://github.com/fbcotter/pytorch_wavelets.git /tmp/pip-req-build-utwg371g did not run successfully.
│ exit code: 128
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

failed

CondaEnvException: Pip failed

3.2.1 方法1-重新编译Git安装OpenSSL版本

重新编译Git从GnuTLS版本到OpenSSL版本

3.2.1.1 安装编译git所需依赖库
sudo apt-get install build-essential fakeroot dpkg-dev
sudo apt-get build-dep git
sudo apt-get install libcurl4-openssl-dev
sudo apt install libssl-dev
3.2.1.2 切换到编译目录
cd ~
mkdir src-git
cd src-git
3.2.1.3 下载git的源码

apt-get source git

(base) fb@VP01:~/src-git$ apt-get source git
Reading package lists... Done
E: You must put some 'deb-src' URIs in your sources.list

这是deb-src源码地址被注释掉了,以提高apt update速度,我们需要开启才能下载git的源码

备份源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list.back

修改源列表,去年deb-src前面的#注释
sudo vim /etc/apt/sources.list

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted
deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ jammy universe
deb-src http://archive.ubuntu.com/ubuntu/ jammy universe
deb http://archive.ubuntu.com/ubuntu/ jammy-updates universe
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ jammy multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted
deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted
deb http://security.ubuntu.com/ubuntu/ jammy-security universe
deb-src http://security.ubuntu.com/ubuntu/ jammy-security universe
deb http://security.ubuntu.com/ubuntu/ jammy-security multiverse
deb-src http://security.ubuntu.com/ubuntu/ jammy-security multiverse

更新源列表
sudo apt-get update

重新下载git源码
apt-get source git

3.2.1.4 修改Gnutls库为OpenSSL库依赖

进入git源码目录
cd git-2.34.1

(base) fb@VP01:~/src-git$ ll
total 7240
drwxr-xr-x  3 fb fb    4096 Apr 10 00:11 ./
drwxr-x--- 13 fb fb    4096 Apr  9 21:15 ../
drwxr-xr-x 28 fb fb   20480 Apr 10 00:11 git-2.34.1/
-rw-r--r--  1 fb fb  753396 Feb 15 02:53 git_2.34.1-1ubuntu1.8.debian.tar.xz
-rw-r--r--  1 fb fb    2927 Feb 15 02:53 git_2.34.1-1ubuntu1.8.dsc
-rw-r--r--  1 fb fb 6623760 Jan 25  2022 git_2.34.1.orig.tar.xz
(base) fb@VP01:~/src-git$ cd git-2.34.1
(base) fb@VP01:~/src-git/git-2.34.1$

不知道是 2.x.x,
可以用通配符进入第一个匹配目录

cd git-2.*.*/

也可以用ll列出详细目录名称

ll

使用 sed 命令将 debian/control 中的 gnutls 库改为 openssl 库
sed -i -- 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/' ./debian/control

删除 test 选项
sed -i -- '/TEST\s*=\s*test/d' ./debian/rules

3.2.1.5 编译安装Git

开始编译
dpkg-buildpackage -rfakeroot -b -uc -us

报错 dpkg-checkbuilddeps: error

dpkg-checkbuilddeps: error: Unmet build dependencies: libz-dev gettext libpcre2-dev | libpcre3-dev libexpat1-dev subversion libsvn-perl libyaml-perl tcl libhttp-date-perl | libtime-parsedate-perl libcgi-pm-perl libmailtools-perl cvs cvsps libdbd-sqlite3-perl unzip libio-pty-perl debhelper-compat (= 10) dh-exec (>= 0.7) dh-apache2 asciidoc (>= 8.6.10) xmlto docbook-xsl
dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting
dpkg-buildpackage: warning: (Use -d flag to override.)

对策:安装缺失的包
sudo apt install libz-dev gettext libpcre2-dev libexpat1-dev subversion libsvn-perl libyaml-perl tcl libhttp-date-perl libcgi-pm-perl libmailtools-perl cvs cvsps libdbd-sqlite3-perl unzip libio-pty-perl debhelper-compat dh-exec dh-apache2 asciidoc xmlto docbook-xsl

再次编译
dpkg-buildpackage -rfakeroot -b -uc -us

报错

/home/fb/anaconda3/bin/python3: No module named asciidoc
make[2]: Leaving directory '/home/fb/src-git/git-2.34.1/Documentation'
make[1]: *** [debian/rules:84: override_dh_auto_build-indep] Error 2
make: *** [debian/rules:55: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

对策:安装缺失的包
pip install asciidoc

再次编译
dpkg-buildpackage -rfakeroot -b -uc -us

安装
sudo dpkg -i ../git_*ubuntu*.deb

成功把Git改造为OpenSSL版本,回到Kan-tts项目目录创建maas虚拟环境

(base) fb@VP01:~/msai/kan-tts$ conda env create -f environment.yaml
Collecting package metadata (repodata.json): done
Solving environment: done

Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: / By downloading and using the CUDA Toolkit conda packages, you accept the terms and conditions of the CUDA End User License Agreement (EULA): https://docs.nvidia.com/cuda/eula/index.html

done
Installing pip dependencies: - Ran pip subprocess with arg
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
很高兴能为您解答关于KAN-TTS搭建SAMBERT个性化语音合成开发环境的问题。以下是一些建议的步骤: 1. 安装依赖:安装Python 3.7版本,并确保您已安装所需的依赖包,如PyTorch、NumPy等。您可以使用pip或conda进行安装。 2. 下载代码:从KAN-TTS的GitHub存储库中下载SAMBERT的源代码。您可以使用git命令克隆该存储库或直接下载zip文件。 3. 数据准备:准备训练数据集和语音特征提取器。您需要一个包含音频和相应文本的数据集,并使用一个语音特征提取器(如Tacotron或Transformer)来生成语音特征。 4. 配置模型:根据您的需求,编辑模型配置文件。在KAN-TTS的源代码中,您可以找到一个名为`hparams.py`的文件,其中包含模型的各种超参数设置。 5. 训练模型:使用准备好的训练数据集对模型进行训练。您可以使用提供的训练脚本来启动训练过程。 6. 评估模型:在训练过程中,您可以使用验证集对模型进行评估,以了解其性能和效果。 7. 合成语音:在完成模型训练后,您可以使用训练得到的模型来合成个性化语音。通过输入文本,模型会生成相应的音频。 请注意,以上步骤只是一个大致的指南,具体的操作细节可能因您的环境和数据集而有所不同。建议您查阅KAN-TTS项目的文档或相关资源,以获得更详细的说明和指导。祝您搭建成功并取得好的结果!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值