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")
相关推荐
风筝在晴天搁浅3 分钟前
解题代码清爽版
java·开发语言
2601_962300814 分钟前
机器学习的理想基石
人工智能·python·机器学习·编程语言·数据处理
Java后端的Ai之路11 分钟前
21、Python - 命令模式
开发语言·人工智能·python·命令模式·外观模式
astronautyi16 分钟前
Go 运行时内存分配与 GC 位图深度剖析
开发语言·后端·golang
2601_9620779820 分钟前
机器学习及其Python实践
pytorch·python·机器学习·tensorflow·scikit-learn
techdashen22 分钟前
Go 中如何处理错误
开发语言·后端·golang
小柯南敲键盘27 分钟前
跨马翻译批量图片视频字幕翻译,跨境电商AI智能抠图一站式工具
人工智能·python·音视频·xcode
2601_9622955834 分钟前
Python中正则表达式的知识汇总分享
python·正则表达式·模块·语法·匹配
ellenwan202637 分钟前
量化实现的难点,常在规则和流程
人工智能·python
2601_9622986739 分钟前
正则表达式引擎 哪些
java·python·perl·pcre·正则表达式引擎