Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

中文README.md中基础用法的代码有误 #866

Open
aoxiangtianyu-go opened this issue Jan 2, 2025 · 2 comments
Open

中文README.md中基础用法的代码有误 #866

aoxiangtianyu-go opened this issue Jan 2, 2025 · 2 comments
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed

Comments

@aoxiangtianyu-go
Copy link

中文README.md中基础用法部分

import ChatTTS
import torch
import torchaudio

chat = ChatTTS.Chat()
chat.load(compile=False) # Set to True for better performance

texts = ["PUT YOUR 1st TEXT HERE", "PUT YOUR 2nd TEXT HERE"]

wavs = chat.infer(texts)

torchaudio.save("output1.wav", torch.from_numpy(wavs[0]), 24000)

应修正为

import ChatTTS
import torch
import torchaudio

chat = ChatTTS.Chat()
chat.load(compile=False) # Set to True for better performance

texts = ["PUT YOUR 1st TEXT HERE", "PUT YOUR 2nd TEXT HERE"]

wavs = chat.infer(texts)

for i in range(len(wavs)):
    """
   在某些版本的torchaudio里,第一行代码能运行,但在另一些版本中,则是第二行代码能运行。
    """
    try:
        torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]).unsqueeze(0), 24000)
    except:
        torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]), 24000)
@ZXX-Coding
Copy link

模型加载好像一直有问题

@fumiama
Copy link
Member

fumiama commented Jan 7, 2025

中文README还未同步,一切以英文版为准。

@fumiama fumiama added documentation Improvements or additions to documentation help wanted Extra attention is needed labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants