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")
相关推荐
万粉变现经纪人12 分钟前
如何解决pip安装报错ModuleNotFoundError: No module named ‘sympy’问题
python·beautifulsoup·pandas·scikit-learn·pyqt·pip·scipy
酷炫码神17 分钟前
第 2 篇:Java 入门实战(JDK8 版)—— 编写第一个 Java 程序,理解基础运行逻辑
java·开发语言·策略模式
像风一样自由202019 分钟前
Go语言详细指南:特点、应用场景与开发工具
开发语言·后端·golang
半夏知半秋21 分钟前
基于跳跃表的zset实现解析(lua版)
服务器·开发语言·redis·学习·lua
Wyc7240928 分钟前
Lua语言基础笔记
开发语言·笔记·lua
xiaohouzi11223335 分钟前
Python读取视频-硬解和软解
python·opencv·ffmpeg·视频编解码·gstreamer
念念不忘 必有回响39 分钟前
Pygame模块化实战:从零构建Aliens射击游戏全流程(一)
python·游戏·pygame
编码浪子5 小时前
趣味学RUST基础篇(智能指针_结束)
开发语言·算法·rust
CVer儿7 小时前
qt资料2025
开发语言·qt
DevilSeagull7 小时前
JavaScript WebAPI 指南
java·开发语言·javascript·html·ecmascript·html5