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.