Skip to content

【help】 RuntimeError: narrow(): length must be non-negative. #978

@leeDWAW

Description

@leeDWAW

code:

import ChatTTS
import torch
import torchaudio

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

texts = ["我爱你"]
chat = ChatTTS.Chat()

chat.load(source="local", compile=False)

wavs = chat.infer(texts)

question:
text: 0%|▍ | 1/384(max) [00:00, 2.28it/s]Traceback (most recent call last):
File "/home/limingyang/code/model/tts/ChatTTS/lmy.py", line 13, in
wavs = chat.infer(texts)
^^^^^^^^^^^^^^^^^
File "/home/limingyang/code/model/tts/ChatTTS/ChatTTS/core.py", line 263, in infer
for wavs in res_gen:
File "/home/limingyang/code/model/tts/ChatTTS/ChatTTS/core.py", line 420, in _infer
refined = self._refine_text(
^^^^^^^^^^^^^^^^^^
File "/home/limingyang/ENTER/envs/chattts/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 120, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/limingyang/code/model/tts/ChatTTS/ChatTTS/core.py", line 730, in _refine_text
result = next(
^^^^^
File "/home/limingyang/ENTER/envs/chattts/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 38, in generator_context
response = gen.send(None)
^^^^^^^^^^^^^^
File "/home/limingyang/code/model/tts/ChatTTS/ChatTTS/model/gpt.py", line 396, in generate
model_input = self._prepare_generation_inputs(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/limingyang/ENTER/envs/chattts/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 120, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/limingyang/code/model/tts/ChatTTS/ChatTTS/model/gpt.py", line 230, in _prepare_generation_inputs
attention_mask = attention_mask.narrow(
^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: narrow(): length must be non-negative.
text: 0%|▍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions