whisperspeech 英文TTS的实现

以下代码成功运行在 colab 中,需要修改运行时类型为 T4 GPU

!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")








相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-02-15 09:22:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-02-15 09:22:01       101 阅读
  3. 在Django里面运行非项目文件

    2024-02-15 09:22:01       82 阅读
  4. Python语言-面向对象

    2024-02-15 09:22:01       91 阅读

热门阅读

  1. Linux命令速查表:简洁高效,一表掌握

    2024-02-15 09:22:01       51 阅读
  2. RabbitMQ的高可用机制

    2024-02-15 09:22:01       53 阅读
  3. react 插槽

    2024-02-15 09:22:01       53 阅读
  4. 支持向量机SVM

    2024-02-15 09:22:01       47 阅读
  5. Spring Cloud Gateway:使用RestController动态更新路由

    2024-02-15 09:22:01       44 阅读
  6. 收藏:《不要和不懂组织的人讨论管理》

    2024-02-15 09:22:01       59 阅读
  7. re:从0开始的CSS之旅 16. 高度塌陷问题

    2024-02-15 09:22:01       45 阅读
  8. 设计模式——适配器模式

    2024-02-15 09:22:01       46 阅读
  9. 容器高级知识:Kubernetes Pod 适配器模式详解

    2024-02-15 09:22:01       56 阅读