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

单页面视频网站模板希爱力5mg效果真实经历

单页面视频网站模板,希爱力5mg效果真实经历,温州城乡建设学校,网站有收录没权重Kokoro是一个具有8200万个参数的开放权重TTS模型。尽管其架构轻巧,但它提供了与较大型号相当的质量,同时速度更快,更具成本效益。使用Apache许可的权重,Kokoro可以部署在从生产环境到个人项目的任何地方。 官网:hexgra…

Kokoro是一个具有8200万个参数的开放权重TTS模型。尽管其架构轻巧,但它提供了与较大型号相当的质量,同时速度更快,更具成本效益。使用Apache许可的权重,Kokoro可以部署在从生产环境到个人项目的任何地方。

官网:hexgrad/kokoro: https://hf.co/hexgrad/Kokoro-82M

现在我们来实践下Kokoro

Linux下安装使用

安装库

pip install -q kokoro>=0.8.2 "misaki[zh]>=0.8.2" soundfile

一键执行安装使用 

为了简单,可以学习官网,直接在kaggle或colab的notebook里,输入下面语句,运行即可:

!pip install -q kokoro>=0.9.4 soundfile
!apt-get -qq -y install espeak-ng > /dev/null 2>&1
from kokoro import KPipeline
from IPython.display import display, Audio
import soundfile as sf
import torch
pipeline = KPipeline(lang_code='a')
text = '''
[Kokoro](/kˈOkəɹO/) is an open-weight TTS model with 82 million parameters. Despite its lightweight architecture, it delivers comparable quality to larger models while being significantly faster and more cost-efficient. With Apache-licensed weights, [Kokoro](/kˈOkəɹO/) can be deployed anywhere from production environments to personal projects.
'''
generator = pipeline(text, voice='af_heart')
for i, (gs, ps, audio) in enumerate(generator):print(i, gs, ps)display(Audio(data=audio, rate=24000, autoplay=i==0))sf.write(f'{i}.wav', audio, 24000)

这些语句包括pip 安装kokoro 和soundfile这两个python包,使用apt 安装了espeak-ng这个软件包(在Ubuntu下) 。

将要转语音的文字赋值给text变量,然后就可以进行文本转换了。

英文效果还行,但是无法混用数字,如果里面有中文就不行。

多种语言

安装中文库

pip install misaki[zh]

在kaggle或colab的notebook里的例子: 

# 1️⃣ Install kokoro
!pip install -q kokoro>=0.9.4 soundfile
# 2️⃣ Install espeak, used for English OOD fallback and some non-English languages
!apt-get -qq -y install espeak-ng > /dev/null 2>&1# 3️⃣ Initalize a pipeline
from kokoro import KPipeline
from IPython.display import display, Audio
import soundfile as sf
import torch
# 🇺🇸 'a' => American English, 🇬🇧 'b' => British English
# 🇪🇸 'e' => Spanish es
# 🇫🇷 'f' => French fr-fr
# 🇮🇳 'h' => Hindi hi
# 🇮🇹 'i' => Italian it
# 🇯🇵 'j' => Japanese: pip install misaki[ja]
# 🇧🇷 'p' => Brazilian Portuguese pt-br
# 🇨🇳 'z' => Mandarin Chinese: pip install misaki[zh]
pipeline = KPipeline(lang_code='a') # <= make sure lang_code matches voice, reference above.# This text is for demonstration purposes only, unseen during training
text = '''
The sky above the port was the color of television, tuned to a dead channel.
"It's not like I'm using," Case heard someone say, as he shouldered his way through the crowd around the door of the Chat. "It's like my body's developed this massive drug deficiency."
It was a Sprawl voice and a Sprawl joke. The Chatsubo was a bar for professional expatriates; you could drink there for a week and never hear two words in Japanese.These were to have an enormous impact, not only because they were associated with Constantine, but also because, as in so many other areas, the decisions taken by Constantine (or in his name) were to have great significance for centuries to come. One of the main issues was the shape that Christian churches were to take, since there was not, apparently, a tradition of monumental church buildings when Constantine decided to help the Christian church build a series of truly spectacular structures. The main form that these churches took was that of the basilica, a multipurpose rectangular structure, based ultimately on the earlier Greek stoa, which could be found in most of the great cities of the empire. Christianity, unlike classical polytheism, needed a large interior space for the celebration of its religious services, and the basilica aptly filled that need. We naturally do not know the degree to which the emperor was involved in the design of new churches, but it is tempting to connect this with the secular basilica that Constantine completed in the Roman forum (the so-called Basilica of Maxentius) and the one he probably built in Trier, in connection with his residence in the city at a time when he was still caesar.[Kokoro](/kˈOkəɹO/) is an open-weight TTS model with 82 million parameters. Despite its lightweight architecture, it delivers comparable quality to larger models while being significantly faster and more cost-efficient. With Apache-licensed weights, [Kokoro](/kˈOkəɹO/) can be deployed anywhere from production environments to personal projects.
'''# 4️⃣ Generate, display, and save audio files in a loop.
generator = pipeline(text, voice='af_heart', # <= change voice herespeed=1, split_pattern=r'\n+'
)
# Alternatively, load voice tensor directly:
# voice_tensor = torch.load('path/to/voice.pt', weights_only=True)
# generator = pipeline(
#     text, voice=voice_tensor,
#     speed=1, split_pattern=r'\n+'
# )for i, (gs, ps, audio) in enumerate(generator):print(i)  # i => indexprint(gs) # gs => graphemes/textprint(ps) # ps => phonemesdisplay(Audio(data=audio, rate=24000, autoplay=i==0))sf.write(f'{i}.wav', audio, 24000) # save each audio file

windows下安装

windows下主要是需要安装espeak-ng ,去这里下载:

​https://github.com/espeak-ng/espeak-ng/releases​

下载espeak-ng安装软件,安装即可。

ONNX部署

安装依赖库

!pip install -U kokoro-onnx soundfile 'misaki[zh]'

下载模型文件

!wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.1/kokoro-v1.1-zh.onnx
!wget     https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.1/voices-v1.1-zh.bin
!wget     https://huggingface.co/hexgrad/Kokoro-82M-v1.1-zh/raw/main/config.json

文本转换

import soundfile as sf
from misaki import zhfrom kokoro_onnx import Kokoro# Misaki G2P with espeak-ng fallback
g2p = zh.ZHG2P(version="1.1")text = "千里之行,始于足下。欢迎使用Kokoro TTS,高效生成自然语音!"
voice = "zf_001"
kokoro = Kokoro("kokoro-v1.1-zh.onnx", "voices-v1.1-zh.bin", vocab_config="config.json")
phonemes, _ = g2p(text)
samples, sample_rate = kokoro.create(phonemes, voice=voice, speed=1.0, is_phonemes=True)
sf.write("audio.wav", samples, sample_rate)
print("Created audio.wav")
display(Audio(data="audio.wav", rate=24000, autoplay=i==0))

推理速度还是较快的。

但是中文里面如果有英文,它是不会读出来的。所以效果还是略差一点。

总结

中文效果较差,英文效果还凑活。

当然kokoro 只有82M大小,能有这个效果已经很不错了!

http://www.dtcms.com/wzjs/53960.html

相关文章:

  • 衡水专业制作网站百度推广广告公司
  • 三亚海棠警方拘留3名涉黄人员电脑优化大师有用吗
  • 口碑好的网站开发公司哪家最专业搜索引擎营销的名词解释
  • 哪里有零基础网站建设教学公司百度app在哪里找
  • 深圳响应式网站公司新站整站优化
  • 在什么网站上可以做免费广告51外链代发网
  • 简述商务网站建设步骤二级域名注册
  • 佛山做网站哪家好网页广告调词平台多少钱
  • 高端网站制作网站建设网络舆情监测系统
  • 高德地图为什么没有国外的地图权威seo技术
  • 做英文网站公司查询百度关键词排名
  • 哪里学软装设计最好seo网络推广经理招聘
  • 讯响模板网站网站优化公司哪家好
  • 网站开发小程序百度竞价排名背后的伦理问题
  • 2017做淘宝客网站还有吗semen是什么意思
  • 新疆昌吉市建设委员会网站优化师培训机构
  • 网站3d展示怎么做域名注册免费
  • 大连个人网站建设怎么做网页
  • wordpress修改底部文字百度seo视频教程
  • 泰州网站建设方案seo必备软件
  • 山东建设执业师专业官方网站链爱交易平台
  • 北京中高端网站建设深圳网络营销推广培训
  • 深圳网站开发专业企业营销咨询
  • 深圳做微信网站多少钱百度广告搜索引擎
  • 淘宝网站建设需求分析影响seo排名的因素
  • 日语网站建设多少钱百度快速排名化
  • 特卖网站怎么做网络营销方案总结
  • 湛江市seo网站设计报价如何增加网站权重
  • 衡水网站制作多少钱软文怎么做
  • 深圳住房建设局网站首页百度指数的使用方法