0

I'm trying to use ChatTTS which uses Torch. I installed it via the Pycharm packages repository (PIP) with no errors.

But when I run the main webpages basic example code.

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)):
    """
    In some versions of torchaudio, the first line works but in other versions, so does the second line.
    """
    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)

It returns the following error,

Traceback (most recent call last):
  File "D:\GOOD\Coding\.Coding_Projects\Composite_media\Text to Speech\Audiobook_Maker\test3.py", line 8, in <module>
    import ChatTTS
  File "C:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\ChatTTS\__init__.py", line 1, in <module>
    from .core import Chat
  File "C:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\ChatTTS\core.py", line 17, in <module>
    from .model import DVAE, Embed, GPT, gen_logits, Tokenizer, Speaker
  File "C:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\ChatTTS\model\__init__.py", line 6, in <module>
    from .tokenizer import Tokenizer
  File "C:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\ChatTTS\model\tokenizer.py", line 16, in <module>
    class Tokenizer:
    ...<121 lines>...
            )
  File "C:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\ChatTTS\model\tokenizer.py", line 19, in Tokenizer
    tokenizer_path: torch.serialization.FILE_LIKE,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'torch.serialization' has no attribute 'FILE_LIKE'

I googled the error message. But there was no matching results.

1 Answer 1

0

This is happening because you're using Python 3.13, which is not currently supported by PyTorch

You should downgrade to Python 3.10 or Python 3.9, which are stable with PyTorch and all its associated packages.

Sign up to request clarification or add additional context in comments.

2 Comments

thank you for responding. I will have to look into this.
I have put in a ticket here to follow the progress. github.com/2noise/ChatTTS/issues/933

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.