feitgemel / Python-Code-Cool-Stuff

Cool stuff using Python and OpenCV
88 stars 30 forks source link

did not work for me #1

Closed ClaireCJS closed 1 year ago

ClaireCJS commented 1 year ago

I use Windows. i followed the youtube video. it seemed impossible to install packages that made it happy.

git clone https://github.com/neonbjb/tortoise-tts.git
cd tortoise-tts
conda create -n tts-voice python=3.8 
conda activate tts
python setup.py install    
conda install -c conda-forge pysoundfile
pip install torchaudio
pip install six
pip install llvmlite==0.39
pip install threadpoolctl
pip install numpy==1.22
pip install importlib_metadata
pip install numba==0.48.0

In particular, it seemed llvmlite version was not something it liked, but changing it to one it liked would make another package complain, and so forth.

Ultimately, I only get this output once i get up to running it:

(tts-voice) C:\working\VOICE\talker2\tortoise-tts>python tortoise\do_tts.py --text "hey hey hey asdoija dsfijasdf "
C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\llvmlite\llvmpy\__init__.py:3: UserWarning: The module `llvmlite.llvmpy` is deprecated and will be removed in the future.
  warnings.warn(
C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\llvmlite\llvmpy\core.py:8: UserWarning: The module `llvmlite.llvmpy.core` is deprecated and will be removed in the future. Equivalent functionality is provided by `llvmlite.ir`.
  warnings.warn(
C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\llvmlite\llvmpy\passes.py:17: UserWarning: The module `llvmlite.llvmpy.passes` is deprecated and will be removed in the future. If you are using this code, it should be inlined into your own project.
  warnings.warn(
Traceback (most recent call last):
  File "tortoise\do_tts.py", line 7, in <module>
    from api import TextToSpeech, MODELS_DIR
  File "C:\working\VOICE\talker2\tortoise-tts\tortoise\api.py", line 22, in <module>
    from tortoise.utils.audio import wav_to_univnet_mel, denormalize_tacotron_mel
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\tortoise-2.4.2-py3.8.egg\tortoise\utils\audio.py", line 10, in <module>
    from tortoise.utils.stft import STFT
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\tortoise-2.4.2-py3.8.egg\tortoise\utils\stft.py", line 38, in <module>
    from librosa.util import pad_center, tiny
  File "<frozen importlib._bootstrap>", line 1039, in _handle_fromlist
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\lazy_loader-0.2-py3.8.egg\lazy_loader\__init__.py", line 76, in __getattr__
    submod = importlib.import_module(submod_path)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\librosa-0.10.0.post2-py3.8.egg\librosa\util\utils.py", line 11, in <module>
    import numba
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\__init__.py", line 196, in <module>
    import numba.typed
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\typed\__init__.py", line 3, in <module>
    from .typeddict import Dict
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\typed\typeddict.py", line 20, in <module>
    def _make_dict(keyty, valty):
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\decorators.py", line 238, in njit
    return jit(*args, **kws)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\decorators.py", line 175, in jit
    return wrapper(pyfunc)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\decorators.py", line 189, in wrapper
    disp = dispatcher(py_func=func, locals=locals,
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\dispatcher.py", line 650, in __init__
    self.targetctx = self.targetdescr.target_context
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\targets\registry.py", line 50, in target_context
    return self._toplevel_target_context
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\utils.py", line 399, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\targets\registry.py", line 34, in _toplevel_target_context
    return cpu.CPUContext(self.typing_context)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\targets\base.py", line 260, in __init__
    self.init()
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\targets\cpu.py", line 51, in init
    self._internal_codegen = codegen.JITCPUCodegen("numba.exec")
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\targets\codegen.py", line 628, in __init__
    self._init(self._llvm_module)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\targets\codegen.py", line 637, in _init
    tm = target.create_target_machine(**tm_options)
TypeError: create_target_machine() got an unexpected keyword argument 'jitdebug'

(tts-voice) C:\working\VOICE\talker2\tortoise-tts>python tortoise\do_tts.py --text "hey hey hey asdoija dsfijasdf " --voice train_dotrice --preset fast
C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\llvmlite\llvmpy\__init__.py:3: UserWarning: The module `llvmlite.llvmpy` is deprecated and will be removed in the future.
  warnings.warn(
C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\llvmlite\llvmpy\core.py:8: UserWarning: The module `llvmlite.llvmpy.core` is deprecated and will be removed in the future. Equivalent functionality is provided by `llvmlite.ir`.
  warnings.warn(
C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\llvmlite\llvmpy\passes.py:17: UserWarning: The module `llvmlite.llvmpy.passes` is deprecated and will be removed in the future. If you are using this code, it should be inlined into your own project.
  warnings.warn(
Traceback (most recent call last):
  File "tortoise\do_tts.py", line 7, in <module>
    from api import TextToSpeech, MODELS_DIR
  File "C:\working\VOICE\talker2\tortoise-tts\tortoise\api.py", line 22, in <module>
    from tortoise.utils.audio import wav_to_univnet_mel, denormalize_tacotron_mel
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\tortoise-2.4.2-py3.8.egg\tortoise\utils\audio.py", line 10, in <module>
    from tortoise.utils.stft import STFT
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\tortoise-2.4.2-py3.8.egg\tortoise\utils\stft.py", line 38, in <module>
    from librosa.util import pad_center, tiny
  File "<frozen importlib._bootstrap>", line 1039, in _handle_fromlist
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\lazy_loader-0.2-py3.8.egg\lazy_loader\__init__.py", line 76, in __getattr__
    submod = importlib.import_module(submod_path)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\librosa-0.10.0.post2-py3.8.egg\librosa\util\utils.py", line 11, in <module>
    import numba
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\__init__.py", line 196, in <module>
    import numba.typed
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\typed\__init__.py", line 3, in <module>
    from .typeddict import Dict
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\typed\typeddict.py", line 20, in <module>
    def _make_dict(keyty, valty):
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\decorators.py", line 238, in njit
    return jit(*args, **kws)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\decorators.py", line 175, in jit
    return wrapper(pyfunc)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\decorators.py", line 189, in wrapper
    disp = dispatcher(py_func=func, locals=locals,
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\dispatcher.py", line 650, in __init__
    self.targetctx = self.targetdescr.target_context
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\targets\registry.py", line 50, in target_context
    return self._toplevel_target_context
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\utils.py", line 399, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\targets\registry.py", line 34, in _toplevel_target_context
    return cpu.CPUContext(self.typing_context)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\targets\base.py", line 260, in __init__
    self.init()
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\targets\cpu.py", line 51, in init
    self._internal_codegen = codegen.JITCPUCodegen("numba.exec")
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\targets\codegen.py", line 628, in __init__
    self._init(self._llvm_module)
  File "C:\ProgramData\anaconda3\envs\tts-voice\lib\site-packages\numba\targets\codegen.py", line 637, in _init
    tm = target.create_target_machine(**tm_options)
TypeError: create_target_machine() got an unexpected keyword argument 'jitdebug'
ClaireCJS commented 1 year ago

I was hoping to get this running, but I think I'm not quite currently knowledgeable enough to get it working 😅

questjay commented 1 year ago

did you install tts?

ClaireCJS commented 1 year ago

I did everything as instructed

feitgemel commented 1 year ago

Did you notice that the name of the Conda enviroment was not correct ? I just fixed it todat

conda create -n tts-voice python=3.8 conda activate tts -> fixed to conda activate tts-voice

feitgemel commented 1 year ago

I see the log and you noticed that

feitgemel commented 1 year ago

Did you run it from Anaconda command prompt , after you activate the enviroment ? I cannot see in your log the Python starting command :

"python tortoise/do_tts.py --text "Hi, Lets go to the mall to buy a new shirt" --voice train_dotrice --preset fast"

ClaireCJS commented 1 year ago

Hi! Thanks for responding go quickly!

Unfortunately between now and then i blew away my tts3 environment and started on a new one called tts4, my 4th attempt to get this going.

The 3rd one actually did succeed at test_cuda at one point, but I ended up breaking it and not being able to fix it, it never actually spoke, and gave me this:

Fatal Python error: init_sys_streams: can't initialize sys standard streams Python runtime state: core initialized Traceback (most recent call last): File "C:\ProgramData\anaconda3\lib\io.py", line 54, in ImportError: cannot import name 'text_encoding' from 'io' (unknown location)


The first 2 attempts I really messed up by using the wrong versions of python i think, and not rebooting after installing visual studio. I also was confused about whether one of the TTS folders was supposed to be within another TTS folder, or if I had messed up. At one point it was \tts3\TTS\TTS\tts\ or such (if i recall correctly) and it seemed wrong.


Anyway, This time, the 4th time, "tts4", , i had everything that needed to be installed installed in advance, then created the new environment and took a lot of care to try to follow the instructions as close as possible.

test_cuda worked on the first try! Sort of!

At first, it gave a Numy warning:

(tts4) C:\ProgramData\anaconda3\envs\tts4\TTS>..\python.exe test_cuda.py test_cuda.py:2: UserWarning: Failed to initialize NumPy: numpy.core.multiarray failed to import (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\utils\tensor_numpy.cpp:84.) x = torch.rand(5, 3) tensor([[0.0165, 0.8247, 0.3321], [0.2408, 0.1185, 0.7754], [0.3005, 0.5455, 0.1416], [0.5895, 0.4286, 0.6721], [0.9268, 0.4512, 0.6637]]) False

I did a pip install numpy which updated it to 1-24.3 which fixed the numpy warning, so now I get that same output without the numpy warning.

But it says "False' at the end.

I know I had a "true" at the end in tts3 before i screwed it up, but this time I'm getting a false this time.

But I know "true" is possible on my setup, so of course, I'm wondering how to fix it, and am a bit lost at this point. I'm a patient person. I can certainly train my model using CPU only, I have a 16-core Ryzen 9 5950X. But of course I'd rather use cuda and have it be faster.

ClaireCJS commented 1 year ago

And just to make things worse...

I did this:

conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda==11.7 -c pytorch -c nvidia

because in my personal notes for my specific machine, i had this listed as a set of packages that successfully pulled CUDA off at one point.

And now if I try test_cuda, I get a NumPy warning again!

[[[ I really hate NumPy. The way they change things between versions without backwards compatibility really seems to make it conflict with a lot of projects ]]]

(tts4) C:\ProgramData\anaconda3\envs\tts4\TTS>python test_cuda.py test_cuda.py:2: UserWarning: Failed to initialize NumPy: DLL load failed while importing _multiarray_umath: The specified module could not be found. (Triggered internally at C:\cb\pytorch_1000000000000\work\torch\csrc\utils\tensor_numpy.cpp:77.) x = torch.rand(5, 3) tensor([[0.4786, 0.9564, 0.9519], [0.2311, 0.7921, 0.5535], [0.4547, 0.6616, 0.0719], [0.8732, 0.9087, 0.5277], [0.4312, 0.7793, 0.7252]]) False

feitgemel commented 1 year ago

Hi, I have just updated the instructions.txt file. Create a new Conda enviroment and run all the updated commands.

Good luck Eran

ClaireCJS commented 1 year ago

I was reading the instructions line by line, so when I got to the line:

install Pytorch from here : https://pytorch.org/get-started/locally/

I went to that website and installed it from the website. They only offer 11.7 minimum. on the site.

But then the next line in your instructions says:

# what is my Cuda version :
nvcc --version

#The following command is for Cuda 11.7.
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

Because my output to nvcc is this:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:26_Pacific_Standard_Time_2019
Cuda compilation tools, release 10.1, V10.1.105

I am wondering if that means I should have done: pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu101

instead of what I did do, which was: pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

I'm scared that I've already taken the wrong path! :)

feitgemel commented 1 year ago

Please look at this link and download a previous version that suitable for your card : https://pytorch.org/get-started/previous-versions/

Are you sure that that you cannot upgrade your Cuda version ? Did you check the Nvidia website ?

Eran

ClaireCJS commented 1 year ago

It's a GeForce RTX 3060 Eagle OC Rev 2.0 12GB card - I'll see about getting a new cuda version

feitgemel commented 1 year ago

I am using the same card. You should update your Cuda version

ClaireCJS commented 1 year ago

Okay! That was the problem! I forget what other project had me downgrade my cuda. It generates voices now!

thank you so much!

I have a long dead celebrity voice I'd like to resurrect.... I think now it may be possible

feitgemel commented 1 year ago

Great :)