whisperspeech 英文TTS的实现

以下代码成功运行在 colab 中,需要修改运行时类型为 T4 GPU

python 复制代码
!pip install -Uqq WhisperSpeech
def is_colab():
    try: import google.colab; return True
    except: return False

import torch
# if not torch.cuda.is_available():
#     if is_colab(): raise BaseException("Please change the runtime type to GPU. In the menu: Runtime -> Change runtime type (the free T4 instance is enough)")
#     else:          raise BaseException("Currently the example notebook requires CUDA, make sure you are running this on a machine with a GPU.")

# %load_ext autoreload
# %autoreload 2

import torch
import torch.nn.functional as F

from IPython.display import Markdown, HTML

# check "7. Pipeline.ipynb"
from whisperspeech.pipeline import Pipeline

pipe = Pipeline(s2a_ref='collabora/whisperspeech:s2a-q4-tiny-en+pl.model')

# pipe.generate_to_notebook("""
# This is the first demo of Whisper Speech, a fully open source text-to-speech model trained by Collabora and Lion on the Juwels supercomputer.
# """)

pipe.generate_to_notebook("""
History will not look kindly on House Republicans for their blatant act of unconstitutional partisanship 
that has targeted an honorable public servant in order to play petty political games. Homeland Security Secretary Mayorkas, 
a Cuban immigrant who came to the United States with his family as political refugees, has spent more than two decades serving America 
with integrity in a decorated career in law enforcement and public service.
""")

#也可以保存到文件:
# pipe.generate_to_file("output.wav", "This is the first demo of Whisper Speech, a fully open source text-to-speech model # trained by Collabora and Lion on the Juwels supercomputer")
相关推荐
Macbethad几秒前
技术报告:加密算法实现与性能优化研究
开发语言
玄同765几秒前
Python 函数:LLM 通用逻辑的封装与复用
开发语言·人工智能·python·深度学习·语言模型·自然语言处理
俞凡3 分钟前
深入理解 Python GIL
python
lkbhua莱克瓦246 分钟前
基础-事务
开发语言·数据库·笔记·mysql·事务
xxxmine8 分钟前
ConcurrentHashMap 和 Hashtable 的区别详解
java·开发语言
luoluoal15 分钟前
基于python的自然语言处理技术的话题文本分类的研究(源码+文档)
python·mysql·django·毕业设计·源码
阿猿收手吧!15 分钟前
【C++】brpc与grpc对比
开发语言·c++
智算菩萨18 分钟前
【Python机器学习】K-Means 聚类:数据分组与用户画像的完整技术指南
人工智能·python·机器学习
会员果汁29 分钟前
算法-拓扑排序-C
c语言·开发语言·算法
Java后端的Ai之路29 分钟前
【神经网络基础】-前向传播说明指南
人工智能·深度学习·神经网络·前向传播