what am I doing wrong here? error generating speech

#11
by MrHugger93 - opened

error:

Generating speech...
Error generating speech: isin() received an invalid combination of arguments - got (elements=Tensor, test_elements=int, ), but expected one of:

  • (Tensor elements, Tensor test_elements, *, bool assume_unique, bool invert, Tensor out)
  • (Number element, Tensor test_elements, *, bool assume_unique, bool invert, Tensor out)
  • (Tensor elements, Number test_element, *, bool assume_unique, bool invert, Tensor out)

code for reference:

import time
from transformers import logging as transformers_logging
from parler_tts import ParlerTTSForConditionalGeneration
from transformers import AutoTokenizer
import soundfile as sf
import torch
import logging
from threading import Thread

logging.basicConfig(level=logging.INFO)
transformers_logging.set_verbosity_info()

print("Checking device availability...")
device = "cuda:0" if torch.cuda.is_available() else "cpu"
print(f"Using device: {device}")

print("Loading model (this might take a few minutes if running for the first time)...")

model_loaded = False

def display_progress_indicator():
while not model_loaded:
print(".", end='', flush=True)
time.sleep(1)

try:
progress_thread = Thread(target=display_progress_indicator)
progress_thread.start()

model = ParlerTTSForConditionalGeneration.from_pretrained("parler-tts/parler_tts_mini_v0.1").to(device)
model_loaded = True
print("\nModel loaded.")

except Exception as e:
model_loaded = True
print(f"\nError loading model: {e}")
exit(1)

print("Loading tokenizer...")
try:
tokenizer = AutoTokenizer.from_pretrained("parler-tts/parler_tts_mini_v0.1")
print("Tokenizer loaded.")
except Exception as e:
print(f"Error loading tokenizer: {e}")
exit(1)

print("Ready for user input.")
prompt = input(": ")
description = "A female speaker with a slightly low-pitched voice delivers her words quite expressively, in a very confined sounding environment with clear audio quality. She speaks very fast."

print("Tokenizing input...")
try:
input_ids = tokenizer(description, return_tensors="pt").input_ids.to(device)
prompt_input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
print("Tokenization completed.")
except Exception as e:
print(f"Error tokenizing input: {e}")
exit(1)

print("Generating speech...")
try:
generation = model.generate(input_ids=input_ids, prompt_input_ids=prompt_input_ids)
audio_arr = generation[0].cpu().numpy().squeeze()
sf.write("parler_tts_out.wav", audio_arr, model.config.sampling_rate)
print("Speech generation completed and saved to parler_tts_out.wav")
except Exception as e:
print(f"Error generating speech: {e}")
exit(1)

full terminal ouput if that helps:
Checking device availability...
Using device: cuda:0
Loading model (this might take a few minutes if running for the first time)...
..................................................................................loading configuration file config.json from cache at C:\Users\hedlu.cache\huggingface\hub\models--parler-tts--parler_tts_mini_v0.1\snapshots\e02fd18e77d38b49a85c7a9a85189a64b8472544\config.json
Model config ParlerTTSConfig {
"_name_or_path": "/fsx/yoach/tmp/artefacts/training-400M-punctuated-v2/",
"architectures": [
"ParlerTTSForConditionalGeneration"
],
"audio_encoder": {
"_name_or_path": "ylacombe/dac_44khZ_8kbps",
"add_cross_attention": false,
"architectures": [
"DACModel"
],
"bad_words_ids": null,
"begin_suppress_tokens": null,
"bos_token_id": null,
"chunk_size_feed_forward": 0,
"codebook_size": 1024,
"cross_attention_hidden_size": null,
"decoder_start_token_id": null,
"diversity_penalty": 0.0,
"do_sample": false,
"early_stopping": false,
"encoder_no_repeat_ngram_size": 0,
"eos_token_id": null,
"exponential_decay_length_penalty": null,
"finetuning_task": null,
"forced_bos_token_id": null,
"forced_eos_token_id": null,
"frame_rate": 86,
"id2label": {
"0": "LABEL_0",
"1": "LABEL_1"
},
"is_decoder": false,
"is_encoder_decoder": false,
"label2id": {
"LABEL_0": 0,
"LABEL_1": 1
},
"latent_dim": 1024,
"length_penalty": 1.0,
"max_length": 20,
"min_length": 0,
"model_bitrate": 8,
"model_type": "dac",
"no_repeat_ngram_size": 0,
"num_beam_groups": 1,
"num_beams": 1,
"num_codebooks": 9,
"num_return_sequences": 1,
"output_attentions": false,
"output_hidden_states": false,
"output_scores": false,
"pad_token_id": null,
"prefix": null,
"problem_type": null,
"pruned_heads": {},
"remove_invalid_values": false,
"repetition_penalty": 1.0,
"return_dict": true,
"return_dict_in_generate": false,
"sampling_rate": 44100,
"sep_token_id": null,
"suppress_tokens": null,
"task_specific_params": null,
"temperature": 1.0,
"tf_legacy_loss": false,
"tie_encoder_decoder": false,
"tie_word_embeddings": true,
"tokenizer_class": null,
"top_k": 50,
"top_p": 1.0,
"torch_dtype": "float32",
"torchscript": false,
"typical_p": 1.0,
"use_bfloat16": false
},
"decoder": {
"_name_or_path": "/fsx/yoach/tmp/artefacts/decoder_400M/",
"activation_dropout": 0.0,
"activation_function": "gelu",
"add_cross_attention": true,
"architectures": [
"ParlerTTSForCausalLM"
],
"attention_dropout": 0.0,
"bad_words_ids": null,
"begin_suppress_tokens": null,
"bos_token_id": 1025,
"chunk_size_feed_forward": 0,
"cross_attention_hidden_size": null,
"decoder_start_token_id": null,
"diversity_penalty": 0.0,
"do_sample": false,
"dropout": 0.1,
"early_stopping": false,
"encoder_no_repeat_ngram_size": 0,
"eos_token_id": 1024,
"exponential_decay_length_penalty": null,
"ffn_dim": 4096,
"finetuning_task": null,
"forced_bos_token_id": null,
"forced_eos_token_id": null,
"hidden_size": 1024,
"id2label": {
"0": "LABEL_0",
"1": "LABEL_1"
},
"initializer_factor": 0.02,
"is_decoder": true,
"is_encoder_decoder": false,
"label2id": {
"LABEL_0": 0,
"LABEL_1": 1
},
"layerdrop": 0.0,
"length_penalty": 1.0,
"max_length": 20,
"max_position_embeddings": 4096,
"min_length": 0,
"model_type": "parler_tts_decoder",
"no_repeat_ngram_size": 0,
"num_attention_heads": 16,
"num_beam_groups": 1,
"num_beams": 1,
"num_codebooks": 9,
"num_hidden_layers": 24,
"num_return_sequences": 1,
"output_attentions": false,
"output_hidden_states": false,
"output_scores": false,
"pad_token_id": 1024,
"prefix": null,
"problem_type": null,
"pruned_heads": {},
"remove_invalid_values": false,
"repetition_penalty": 1.0,
"return_dict": true,
"return_dict_in_generate": false,
"scale_embedding": false,
"sep_token_id": null,
"suppress_tokens": null,
"task_specific_params": null,
"temperature": 1.0,
"tf_legacy_loss": false,
"tie_encoder_decoder": false,
"tie_word_embeddings": false,
"tokenizer_class": null,
"top_k": 50,
"top_p": 1.0,
"torch_dtype": "float32",
"torchscript": false,
"typical_p": 1.0,
"use_bfloat16": false,
"use_cache": true,
"vocab_size": 1088
},
"decoder_start_token_id": 1025,
"is_encoder_decoder": true,
"model_type": "parler_tts",
"pad_token_id": 1024,
"text_encoder": {
"_name_or_path": "google/flan-t5-base",
"add_cross_attention": false,
"architectures": [
"T5ForConditionalGeneration"
],
"bad_words_ids": null,
"begin_suppress_tokens": null,
"bos_token_id": null,
"chunk_size_feed_forward": 0,
"classifier_dropout": 0.0,
"cross_attention_hidden_size": null,
"d_ff": 2048,
"d_kv": 64,
"d_model": 768,
"decoder_start_token_id": 0,
"dense_act_fn": "gelu_new",
"diversity_penalty": 0.0,
"do_sample": false,
"dropout_rate": 0.1,
"early_stopping": false,
"encoder_no_repeat_ngram_size": 0,
"eos_token_id": 1,
"exponential_decay_length_penalty": null,
"feed_forward_proj": "gated-gelu",
"finetuning_task": null,
"forced_bos_token_id": null,
"forced_eos_token_id": null,
"id2label": {
"0": "LABEL_0",
"1": "LABEL_1"
},
"initializer_factor": 1.0,
"is_decoder": false,
"is_encoder_decoder": true,
"is_gated_act": true,
"label2id": {
"LABEL_0": 0,
"LABEL_1": 1
},
"layer_norm_epsilon": 1e-06,
"length_penalty": 1.0,
"max_length": 20,
"min_length": 0,
"model_type": "t5",
"n_positions": 512,
"no_repeat_ngram_size": 0,
"num_beam_groups": 1,
"num_beams": 1,
"num_decoder_layers": 12,
"num_heads": 12,
"num_layers": 12,
"num_return_sequences": 1,
"output_attentions": false,
"output_hidden_states": false,
"output_past": true,
"output_scores": false,
"pad_token_id": 0,
"prefix": null,
"problem_type": null,
"pruned_heads": {},
"relative_attention_max_distance": 128,
"relative_attention_num_buckets": 32,
"remove_invalid_values": false,
"repetition_penalty": 1.0,
"return_dict": true,
"return_dict_in_generate": false,
"sep_token_id": null,
"suppress_tokens": null,
"task_specific_params": {
"summarization": {
"early_stopping": true,
"length_penalty": 2.0,
"max_length": 200,
"min_length": 30,
"no_repeat_ngram_size": 3,
"num_beams": 4,
"prefix": "summarize: "
},
"translation_en_to_de": {
"early_stopping": true,
"max_length": 300,
"num_beams": 4,
"prefix": "translate English to German: "
},
"translation_en_to_fr": {
"early_stopping": true,
"max_length": 300,
"num_beams": 4,
"prefix": "translate English to French: "
},
"translation_en_to_ro": {
"early_stopping": true,
"max_length": 300,
"num_beams": 4,
"prefix": "translate English to Romanian: "
}
},
"temperature": 1.0,
"tf_legacy_loss": false,
"tie_encoder_decoder": false,
"tie_word_embeddings": false,
"tokenizer_class": null,
"top_k": 50,
"top_p": 1.0,
"torch_dtype": null,
"torchscript": false,
"typical_p": 1.0,
"use_bfloat16": false,
"use_cache": true,
"vocab_size": 32128
},
"torch_dtype": "float32",
"transformers_version": "4.41.0",
"vocab_size": 32128
}

loading weights file model.safetensors from cache at C:\Users\hedlu.cache\huggingface\hub\models--parler-tts--parler_tts_mini_v0.1\snapshots\e02fd18e77d38b49a85c7a9a85189a64b8472544\model.safetensors
Generate config GenerationConfig {
"decoder_start_token_id": 1025,
"pad_token_id": 1024
}

...Generate config GenerationConfig {
"bos_token_id": 1025,
"eos_token_id": 1024,
"pad_token_id": 1024
}

...............All model checkpoint weights were used when initializing ParlerTTSForConditionalGeneration.

All the weights of ParlerTTSForConditionalGeneration were initialized from the model checkpoint at parler-tts/parler_tts_mini_v0.1.
If your task is similar to the task the model of the checkpoint was trained on, you can already use ParlerTTSForConditionalGeneration for predictions without further training.
.....loading configuration file generation_config.json from cache at C:\Users\hedlu.cache\huggingface\hub\models--parler-tts--parler_tts_mini_v0.1\snapshots\e02fd18e77d38b49a85c7a9a85189a64b8472544\generation_config.json
Generate config GenerationConfig {
"bos_token_id": 1025,
"decoder_start_token_id": 1025,
"do_sample": true,
"eos_token_id": 1024,
"guidance_scale": 1.0,
"max_length": 2580,
"min_new_tokens": 50,
"pad_token_id": 1024
}

....
Model loaded.
Loading tokenizer...
loading file spiece.model from cache at C:\Users\hedlu.cache\huggingface\hub\models--parler-tts--parler_tts_mini_v0.1\snapshots\e02fd18e77d38b49a85c7a9a85189a64b8472544\spiece.model
loading file tokenizer.json from cache at C:\Users\hedlu.cache\huggingface\hub\models--parler-tts--parler_tts_mini_v0.1\snapshots\e02fd18e77d38b49a85c7a9a85189a64b8472544\tokenizer.json
loading file added_tokens.json from cache at None
loading file special_tokens_map.json from cache at C:\Users\hedlu.cache\huggingface\hub\models--parler-tts--parler_tts_mini_v0.1\snapshots\e02fd18e77d38b49a85c7a9a85189a64b8472544\special_tokens_map.json
loading file tokenizer_config.json from cache at C:\Users\hedlu.cache\huggingface\hub\models--parler-tts--parler_tts_mini_v0.1\snapshots\e02fd18e77d38b49a85c7a9a85189a64b8472544\tokenizer_config.json
You set add_prefix_space. The tokenizer needs to be converted from the slow tokenizers
Tokenizer loaded.
Ready for user input.
: all hail Pythonn!
Tokenizing input...
Tokenization completed.
Generating speech...
Error generating speech: isin() received an invalid combination of arguments - got (elements=Tensor, test_elements=int, ), but expected one of:

  • (Tensor elements, Tensor test_elements, *, bool assume_unique, bool invert, Tensor out)
  • (Number element, Tensor test_elements, *, bool assume_unique, bool invert, Tensor out)
  • (Tensor elements, Number test_element, *, bool assume_unique, bool invert, Tensor out)

Process finished with exit code 1

Nvm had conflicting vida installs, trying fresh with cu118 now, brb

Sign up or log in to comment