当前位置: 首页 > news >正文

监理建设协会网站wordpress关注微信登陆

监理建设协会网站,wordpress关注微信登陆,商业网页设计与制作图片,打好代码怎么做网站1.开发背景上一章节使用了 MegaTTS3 实现文本转语音,但是后面才发现只能使用官方的语言包,没看到克隆功能,所以重新找了一个可以克隆语音的开源模型。2.开发需求在 Ubuntu 下实现 Spark-TTS 的部署,实现官方语音克隆,根…

 1.开发背景

        上一章节使用了 MegaTTS3 实现文本转语音,但是后面才发现只能使用官方的语言包,没看到克隆功能,所以重新找了一个可以克隆语音的开源模型。

2.开发需求

        在 Ubuntu 下实现 Spark-TTS 的部署,实现官方语音克隆,根据自定义文本输出语音。

3.开发环境

        Ubuntu20.04 + Conda + Spark-TTS + RTX5060TI

4.实现步骤

4.1 安装环境

# 创建环境 python 版本建议 3.10 以上
conda create -n sparktts python=3.12# 进入环境
conda activate sparktts # 退出环境
conda deactivate

4.2 获取源码

4.2.1 修改网络配置

        如果不修改网络配置可能会导致克隆端口访问失败,可选

sudo vi /etc/resolv.conf
#nameserver 127.0.0.53
options edns0 trust-adnameserver 8.8.8.8
nameserver 8.8.4.4
4.2.2 下载源码
# 克隆开源源码
git clone https://gitee.com/mirrors/Spark-TTS.git

4.3 安装环境

# 进入环境 这个很重要
conda activate sparktts # 进入源码
cd Spark-TTS# 安装相关环境
pip install -r requirements.txt
4.3.1 重装 Pytorch 
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu129

4.4 运行推理

4.4.1 下载模型
# 下载权重文件 注意下载路径
mkdir -p pretrained_models
cd pretrained_models
git clone https://www.modelscope.cn/SparkAudio/Spark-TTS-0.5B.git
4.4.2 官方推理
cd example
bash infer.sh
 4.4.3 克隆推理

        准备一段语音,可以是自己的,这里准备了录音 yjh.wav。照抄 infer.sh 如下

(sparktts) yangjinghui@MICROSO-9VFB07B:~/code/py312/Spark-TTS/example$ cat yjh.sh
#!/bin/bash# Copyright (c) 2025 SparkAudio
#               2025 Xinsheng Wang (w.xinshawn@gmail.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.# Get the absolute path of the script's directory
script_dir=$(dirname "$(realpath "$0")")# Get the root directory
root_dir=$(dirname "$script_dir")# Set default parameters
device=0
save_dir='example/results'
model_dir="pretrained_models/Spark-TTS-0.5B"
#text="我都服了你们这群老六了~~~,整天在搞三搞四的,一点正事都不敢,你大爷的!"
text="我觉得吧,您说的也不一定是对的,我是不会听你的。"
prompt_text="我觉得吧,您说得对。我会按照您说的方法去做的,好吧。"
prompt_speech_path="example/yjh.wav"# Change directory to the root directory
cd "$root_dir" || exitsource sparktts/utils/parse_options.sh# Run inference
python -m cli.inference \--text "${text}" \--device "${device}" \--save_dir "${save_dir}" \--model_dir "${model_dir}" \--prompt_text "${prompt_text}" \--prompt_speech_path "${prompt_speech_path}"

        主要修改 text、prompt_text 和 prompt_speech_path,prompt_text 与语音内容保持一致

(sparktts) yangjinghui@MICROSO-9VFB07B:~/code/py312/Spark-TTS/example$ sh yjh.sh
yjh.sh: 37: source: not found
2025-07-26 09:33:51,283 - INFO - Using model from: pretrained_models/Spark-TTS-0.5B
2025-07-26 09:33:51,283 - INFO - Saving audio to: example/results
2025-07-26 09:33:51,359 - INFO - Using CUDA device: cuda:0
/home/yangjinghui/application/anaconda3/envs/sparktts/lib/python3.12/site-packages/torch/nn/utils/weight_norm.py:144: FutureWarning: `torch.nn.utils.weight_norm` is deprecated in favor of `torch.nn.utils.parametrizations.weight_norm`.WeightNorm.apply(module, name, dim)
Missing tensor: mel_transformer.spectrogram.window
Missing tensor: mel_transformer.mel_scale.fb
2025-07-26 09:33:58,138 - INFO - Starting inference...
Setting `pad_token_id` to `eos_token_id`:None for open-end generation.
2025-07-26 09:34:02,434 - INFO - Audio saved at: example/results/20250726093358.wav

        运行效果一般般吧

http://www.dtcms.com/a/524215.html

相关文章:

  • 常用串行通信协议核心区别(含CAN、SPI、I2C、UART、RS-485、Ethernet、USB)
  • LangChain1.0发布
  • 压缩与缓存调优实战指南:从0到1根治性能瓶颈(五)
  • 使用 RPM 包在 Linux 7 上安装 MySQL 8
  • 云服务器2008做网站wordpress用thinkphp
  • 仓颉标准库std源码深度解析:构建全场景智能应用的基石
  • C4D域力场的应用之粒子随风飘散解析
  • 自己做的网站别人怎么访问安康网站建设公司电话
  • uniapp小程序实现手动向上滑动窗口
  • vue3:uniapp全局颜色变量配置思路:使用js变量
  • wordpress调用 别的网站昆明seo网站排名
  • 网站建设模板素材重庆互联网大厂
  • 网络爬虫指南:从原理到实战
  • 小杰-自然语言处理(four)——transformer系列——注意力机制
  • Java SpringAOP --- AOP的使用,AOP的源码
  • 阿里云渠道商:如何设置阿里云的安全组规则?
  • 网站设计速成如何让百度快速收录网站文章
  • 北京平台网站建设多少钱学院网站建设的特色
  • 外贸soho建站多少钱山东省住房和城乡建设厅官方网站
  • 芯科科技推出智能开发工具Simplicity Ecosystem软件开发套件开启物联网开发的新高度
  • 报错: lfstackPack redeclared in this block / go版本混乱,清理旧版本
  • 和鲸科技入选《大模型一体机产业图谱》,以一体机智驱科研、重塑教学
  • Go语言:关于怎么在线学习go语言的建议
  • 树 B树和B+树
  • 【arXiv2025】Real-Time Object Detection Meets DINOv3
  • 绍兴网站建设专业的公司4000-262-怎么在百度上发帖推广
  • AH2203输入12v输出3v 6v 9v/2A同步降压LED驱动器芯片
  • C如何调用Go
  • 使用Mathematica编写一个高效的Langevin方程求解器
  • 中国软件企业出海,为什么80%都选择这家服务商?