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

[Bug] bark not working #4116

Open
MarcoLavoro opened this issue Dec 30, 2024 · 4 comments
Open

[Bug] bark not working #4116

MarcoLavoro opened this issue Dec 30, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@MarcoLavoro
Copy link

MarcoLavoro commented Dec 30, 2024

Describe the bug

the bark model seems not work (the other models works fine)
this is an example of code

tts --text "Text for TTS" --model_name "tts_models/multilingual/multi-dataset/bark" --out_path output/path/speech.wav

To Reproduce

just use this code:
tts --text "Text for TTS" --model_name "tts_models/multilingual/multi-dataset/bark" --out_path output/path/speech.wav
or this one
`from TTS.api import TTS

tts = TTS("tts_models/multilingual/multi-dataset/bark", gpu=True)

tts.tts_to_file(text="Hello, my name is Manmay , how are you?",
file_path="output.wav",
voice_dir="bark_voices/",
speaker="ljspeech")

tts.tts_to_file(text="Hello, my name is Manmay , how are you?",
file_path="output.wav",
voice_dir="bark_voices/",
speaker="ljspeech")

tts = TTS("tts_models/multilingual/multi-dataset/bark", gpu=True)
tts.tts_to_file("hello world", file_path="out.wav")
`

Expected behavior

that i not get error and i get the audio file

Logs

C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\tts\layers\bark\load_model.py:121: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  checkpoint = torch.load(ckpt_path, map_location=device)
Traceback (most recent call last):
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\Scripts\tts.exe\__main__.py", line 7, in <module>
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\bin\synthesize.py", line 423, in main
    synthesizer = Synthesizer(
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\utils\synthesizer.py", line 109, in __init__
    self._load_tts_from_dir(model_dir, use_cuda)
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\utils\synthesizer.py", line 164, in _load_tts_from_dir
    self.tts_model.load_checkpoint(config, checkpoint_dir=model_dir, eval=True)
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\tts\models\bark.py", line 281, in load_checkpoint
    self.load_bark_models()
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\tts\models\bark.py", line 50, in load_bark_models
    self.semantic_model, self.config = load_model(
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\tts\layers\bark\load_model.py", line 121, in load_model
    checkpoint = torch.load(ckpt_path, map_location=device)
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\serialization.py", line 1384, in load
    return _legacy_load(
  File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\serialization.py", line 1628, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '<'.

Environment

tts versione 2

Additional context

No response

@MarcoLavoro MarcoLavoro added the bug Something isn't working label Dec 30, 2024
@eginhard
Copy link
Contributor

Use our fork instead (via pip install coqui-tts), it is fixed there. This repo is not maintained anymore.

@MarcoLavoro
Copy link
Author

path

thanks, I tried to do

but now I get the error:

C:\OFFLINEPROJECTS\BOTS\coquiTTS2>tts --text "Text for TTS" --model_name "tts_models/multilingual/multi-dataset/bark" --out_path output/path/speech.wav tts_models/multilingual/multi-dataset/bark is already downloaded. Using model: bark C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\utils\weight_norm.py:143: FutureWarning: torch.nn.utils.weight_normis deprecated in favor oftorch.nn.utils.parametrizations.weight_norm. WeightNorm.apply(module, name, dim) loading text model from C:\Users\carlo\AppData\Local\tts\tts_models--multilingual--multi-dataset--bark\text_2.pt... WARNING: found outdated text model, removing... text model not found, downloading... 100%|████████████████████████████████████████████████████████████████████████████| 18.9k/18.9k [00:00<00:00, 4.70MiB/s] Traceback (most recent call last): File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\Scripts\tts.exe\__main__.py", line 7, in <module> File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\bin\synthesize.py", line 362, in main api = TTS( File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\api.py", line 96, in __init__ self.load_tts_model_by_name(model_name, vocoder_name, gpu=gpu) File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\api.py", line 215, in load_tts_model_by_name self.synthesizer = Synthesizer( File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\utils\synthesizer.py", line 111, in __init__ self._load_tts_from_dir(model_dir, use_cuda) File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\utils\synthesizer.py", line 182, in _load_tts_from_dir self.tts_model.load_checkpoint(config, checkpoint_dir=model_dir, eval=True) File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\tts\models\bark.py", line 275, in load_checkpoint self.load_bark_models() File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\tts\models\bark.py", line 50, in load_bark_models self.semantic_model, self.config = load_model( File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\TTS\tts\layers\bark\load_model.py", line 117, in load_model checkpoint = torch.load(ckpt_path, map_location=device, weights_only=is_pytorch_at_least_2_4()) File "C:\Users\carlo\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\serialization.py", line 1383, in load raise pickle.UnpicklingError(_get_wo_message(str(e))) from None _pickle.UnpicklingError: Weights only load failed. Re-running torch.loadwithweights_onlyset toFalsewill likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source. Please file an issue with the following so that we can makeweights_only=True` compatible with your use case: WeightsUnpickler error: Unsupported operand 60

Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.`

@eginhard
Copy link
Contributor

Thanks, I'll look into it. In the meantime, you can downgrade your Pytorch version to 2.3 or lower and it should probably work because it uses weights_only=False in that case.

@eginhard
Copy link
Contributor

eginhard commented Jan 6, 2025

It works fine for me. Could you list the versions of installed dependencies (pip list)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants