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")
相关推荐
love530love4 小时前
OpenClaw Windows Companion 桌面客户端 连接 LM Studio 完整配置指南
人工智能·windows·python·openclaw
程序喵大人6 小时前
【C++进阶】STL容器与迭代器 - 01 STL 容器先解决元素放在哪里
开发语言·c++·stl
cui_ruicheng6 小时前
Python从入门到实战(十六):多进程编程
开发语言·python
wdfk_prog7 小时前
嵌入式面试真题第 15 题:不可恢复异常后的通用崩溃快照、调用栈保存与离线分析架构
linux·开发语言·面试·架构
_Jimmy_8 小时前
FastAPI + SQLAlchemy全局事务管理
python·fastapi
晴空了无痕8 小时前
从 Go 基础到 K8s:一条可落地的 Go 服务端成长路线
开发语言·后端·golang·kubernetes
用户8356290780518 小时前
如何使用 Python 在 Excel 中添加、编辑和删除超链接
后端·python
神明不懂浪漫8 小时前
【第五章】Java中的继承与多态
java·开发语言
神州世通9 小时前
解密企业通信安全防线:Avaya Aura 三层安全架构深度解析
开发语言·php
AC赳赳老秦9 小时前
企业工商公开信息采集分析:OpenClaw 批量查询企业工商信息,生成企业画像报告
大数据·开发语言·python·自动化·php·deepseek·openclaw