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")
相关推荐
枫叶丹412 分钟前
【Qt开发】显示类控件(一)-> QLabel
开发语言·qt
Python私教25 分钟前
源滚滚Rust全栈班v1.02 无符号整数详解
开发语言·后端·rust
yBmZlQzJ41 分钟前
PyQt5 修改标签字体和颜色的程序
开发语言·python·qt
胖达不服输44 分钟前
「日拱一码」081 机器学习——梯度增强特征选择GBFS
人工智能·python·算法·机器学习·梯度增强特征选择·gbfs
大千AI助手1 小时前
VeRL:强化学习与大模型训练的高效融合框架
人工智能·深度学习·神经网络·llm·强化学习·verl·字节跳动seed
float_六七1 小时前
Java Stream流:从入门到精通
java·windows·python
星空的资源小屋1 小时前
PPTist,一个完全免费的 AI 生成 PPT 在线网站
人工智能·python·电脑·excel
初级炼丹师(爱说实话版)1 小时前
2025算法八股——深度学习——优化器小结
人工智能·深度学习·算法
10001hours1 小时前
C语言第12讲
c语言·开发语言
AI算法工程师Moxi1 小时前
人工智能在医学图像中的应用:从机器学习到深度学习
人工智能·深度学习·机器学习