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

Error on the random voice example #192

Open
vroger11 opened this issue Jan 24, 2025 · 1 comment
Open

Error on the random voice example #192

vroger11 opened this issue Jan 24, 2025 · 1 comment

Comments

@vroger11
Copy link

Using the Random voice example from the readme I got this error:

Traceback (most recent call last):
File "/Users/vincent.roger/git/parler-tts-test/test.py", line 18, in
generation = model.generate(input_ids=input_ids, prompt_input_ids=prompt_input_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vincent.roger/git/parler-tts-test/.venv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/vincent.roger/git/parler-tts-test/.venv/lib/python3.12/site-packages/parler_tts/modeling_parler_tts.py", line 3425, in generate
model_kwargs["attention_mask"] = self._prepare_attention_mask_for_generation(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vincent.roger/git/parler-tts-test/.venv/lib/python3.12/site-packages/transformers/generation/utils.py", line 585, in _prepare_attention_mask_for_generation
pad_token_id = generation_config._pad_token_tensor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Tensor' object has no attribute '_pad_token_tensor'

Here are the versions of the libraries I used:
python: 3.12
accelerate: 1.3.0
soundfile: 0.13.0
torch: 2.5.1
transformers: 4.48.1
parler-tts: 0.2.2 with commit version: d108732

@ptrxwsmitt
Copy link

ptrxwsmitt commented Jan 29, 2025

got the same issue:
python: 3.12
accelerate: 1.3.0
soundfile: 0.13.0
torch: 2.5.1
transformers: 4.48.1
parler-tts -> did not check commit yet, but latest commit from github as documentation

UPDATE:
After reading examples from https://github.com/huggingface/parler-tts/blob/main/INFERENCE.md and some experimenting it seems that we actually need to set the attention_mask and prompt_attention_mask in the Random voice example.

The follwing example is for the prompt. Do the same for the description:

prompt_tokenized = tokenizer(
    text=prompt,
    return_tensors="pt",
)
prompt_input_ids = prompt_tokenized.input_ids.to(device)
prompt_attn_mask = prompt_tokenized.attention_mask.to(device)

That worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants