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")
相关推荐
long31636 分钟前
java 工厂方法设计模式 FactoryMethod
java·开发语言·后端·设计模式
java1234_小锋1 小时前
[免费]基于Python的影视数据可视化分析系统(Flask+echarts)【论文+源码+SQL脚本】
python·信息可视化·flask·python影视分析·python电影分析
计算机sci论文精选3 小时前
CVPR2025敲门砖丨机器人结合多模态+时空Transformer直冲高分,让你的论文不再灌水
人工智能·科技·深度学习·机器人·transformer·cvpr
精致先生4 小时前
Streamlit实现Qwen对话机器人
python·机器人·大模型·streamlit
柯南二号4 小时前
MacOS 系统计算机专业好用工具安装
开发语言·lua
华清远见成都中心4 小时前
基于深度学习的异常检测算法在时间序列数据中的应用
人工智能·深度学习·算法
蜀中廖化5 小时前
机器学习:基于OpenCV和Python的智能图像处理 实战
python·opencv·机器学习
神洛华5 小时前
Lua语言程序设计2:函数、输入输出、控制结构
开发语言·lua
java1234_小锋5 小时前
一周学会Matplotlib3 Python 数据可视化-绘制热力图(Heatmap)
开发语言·python·信息可视化·matplotlib·matplotlib3
梁辰兴5 小时前
数据结构:串、数组与广义表
开发语言·数据结构·c··数组·广义表