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 running demonstration: TypeError: __init__() got multiple values for argument 'enabled' #93

Closed
HandsomeDevilv112 opened this issue Jun 7, 2022 · 13 comments

Comments

@HandsomeDevilv112
Copy link

HandsomeDevilv112 commented Jun 7, 2022

I sure think I got everything installed and ready to work with my 3090, but when I try to run
python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fast
I receive
Generating autoregressive samples.. 100%|█████████████████████████████████████████████| 6/6 [00:03<00:00, 1.63it/s] Computing best candidates using CLVP 0%| | 0/6 [00:00<?, ?it/s]/home/al/.local/lib/python3.8/site-packages/torch/utils/checkpoint.py:25: UserWarning: None of the inputs have requires_grad=True. Gradients will be None warnings.warn("None of the inputs have requires_grad=True. Gradients will be None") 100%|█████████████████████████████████████████████| 6/6 [00:00<00:00, 6.15it/s] Transforming autoregressive outputs into audio.. 0%| | 0/80 [00:00<?, ?it/s] Traceback (most recent call last): File "tortoise/do_tts.py", line 37, in <module> gen, dbg_state = tts.tts_with_preset(args.text, k=args.candidates, voice_samples=voice_samples, conditioning_latents=conditioning_latents, File "/home/al/tortoise-tts/tortoise/api.py", line 325, in tts_with_preset return self.tts(text, **settings) File "/home/al/tortoise-tts/tortoise/api.py", line 488, in tts mel = do_spectrogram_diffusion(self.diffusion, diffuser, latents, diffusion_conditioning, File "/home/al/tortoise-tts/tortoise/api.py", line 158, in do_spectrogram_diffusion mel = diffuser.p_sample_loop(diffusion_model, output_shape, noise=noise, File "/home/al/.local/lib/python3.8/site-packages/TorToiSe-2.4.2-py3.8.egg/tortoise/utils/diffusion.py", line 565, in p_sample_loop for sample in self.p_sample_loop_progressive( File "/home/al/.local/lib/python3.8/site-packages/TorToiSe-2.4.2-py3.8.egg/tortoise/utils/diffusion.py", line 611, in p_sample_loop_progressive out = self.p_sample( File "/home/al/.local/lib/python3.8/site-packages/TorToiSe-2.4.2-py3.8.egg/tortoise/utils/diffusion.py", line 514, in p_sample out = self.p_mean_variance( File "/home/al/.local/lib/python3.8/site-packages/TorToiSe-2.4.2-py3.8.egg/tortoise/utils/diffusion.py", line 1121, in p_mean_variance return super().p_mean_variance(self._wrap_model(model), *args, **kwargs) File "/home/al/.local/lib/python3.8/site-packages/TorToiSe-2.4.2-py3.8.egg/tortoise/utils/diffusion.py", line 340, in p_mean_variance model_output = model(x, self._scale_timesteps(t), **model_kwargs) File "/home/al/.local/lib/python3.8/site-packages/TorToiSe-2.4.2-py3.8.egg/tortoise/utils/diffusion.py", line 1220, in __call__ return self.model(x, new_ts, **kwargs) File "/home/al/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "/home/al/.local/lib/python3.8/site-packages/TorToiSe-2.4.2-py3.8.egg/tortoise/models/diffusion_decoder.py", line 306, in forward with autocast(x.device.type, enabled=self.enable_fp16 and i != 0): TypeError: __init__() got multiple values for argument 'enabled'
and I'm a bit stumped.

@neonbjb
Copy link
Owner

neonbjb commented Jun 7, 2022

Looks like you might be using an old version of pytorch. What version are you using? Try updating it if it's older than 1.10. Not sure when this function signature changed but it was somewhere around there.

@HandsomeDevilv112
Copy link
Author

HandsomeDevilv112 commented Jun 7, 2022

running
python
import torch
print(torch.__version__)
in my environment, says
1.11.0+cu113

EDIT:
I have an environment that has 1.8.1+cu111, it produces a different error.
Traceback (most recent call last): File "/home/al/tortoise-tts/tortoise/do_tts.py", line 7, in <module> from api import TextToSpeech, MODELS_DIR File "/home/al/tortoise-tts/tortoise/api.py", line 13, in <module> from tortoise.models.diffusion_decoder import DiffusionTts File "/home/al/anaconda3/envs/py39/lib/python3.9/site-packages/TorToiSe-2.4.2-py3.9.egg/tortoise/models/diffusion_decoder.py", line 8, in <module> from torch import autocast ImportError: cannot import name 'autocast' from 'torch' (/home/al/anaconda3/envs/py39/lib/python3.9/site-packages/torch/__init__.py)

@neonbjb
Copy link
Owner

neonbjb commented Jun 8, 2022

Hey, I'm pretty stumped too. The error is saying the "enabled" parameter is being specified twice. It points out this line:
https://github.com/neonbjb/tortoise-tts/blob/main/tortoise/models/diffusion_decoder.py#L305

There are only two parameters specified to this function, one is a keyword arg "enabled". The error is essentially implying that the positional arg is also "enabled". This was the case for older versions of Torch, but has not been the case for some time now (I think since 1.9?). See the docs:
https://pytorch.org/docs/stable/amp.html?highlight=autocast#torch.autocast

I still suspect there is some dependency issue on your end, as many people (including myself) have exercised this code and have not had any issues. One thing you could do is simply delete the line in question. For inference, it isn't doing anything. You'll need to unindent the block it covers.

@neonbjb neonbjb closed this as completed Jun 8, 2022
@HandsomeDevilv112
Copy link
Author

I'm still getting this if I try to run it from command line, but I am able to get around this by using the notebook.

@neonbjb
Copy link
Owner

neonbjb commented Sep 7, 2022

This should work with torch11, but try upgrading? The function being pointed to is here: https://pytorch.org/docs/stable/amp.html#autocasting

@HandsomeDevilv112
Copy link
Author

Making some minor tweaks, I've been able to use both versions of the collab locally with the pre-trained voices in my environment. (The ipynb you download with the directory is different than the link you have in the description. They have slightly different requirements the other.)
However, with the notebook that includes training a new voice, I'm hitting errors attempting to run cell 7 attempting to upload local files to my local collab.

Mind if I ask you for your package/version list, along with which version of python you're running? I'm having a real hard time imagining what I'm doing differently than you at this point.

@neonbjb
Copy link
Owner

neonbjb commented Sep 11, 2022

Sure, here is a list of packages in a python environment that runs Tortoise on Windows. Most packages are not required.

Package                            Version
---------------------------------- --------------------
absl-py                            1.0.0
aiohttp                            3.8.1
aiosignal                          1.2.0
alabaster                          0.7.12
anaconda-client                    1.9.0
anaconda-navigator                 2.1.1
anaconda-project                   0.10.1
antlr4-python3-runtime             4.9.3
anyio                              2.2.0
appdirs                            1.4.4
argh                               0.26.2
argon2-cffi                        20.1.0
arrow                              0.13.1
asn1crypto                         1.4.0
astroid                            2.6.6
astropy                            4.3.1
async-generator                    1.10
async-timeout                      4.0.2
atomicwrites                       1.4.0
attrs                              21.4.0
autopep8                           1.5.7
Babel                              2.9.1
backcall                           0.2.0
backports.functools-lru-cache      1.6.4
backports.shutil-get-terminal-size 1.0.0
backports.tempfile                 1.0
backports.weakref                  1.0.post1
bcrypt                             3.2.0
beautifulsoup4                     4.11.1
binaryornot                        0.4.4
bitarray                           2.3.0
bkcharts                           0.2
black                              19.10b0
bleach                             4.0.0
bokeh                              2.4.1
boto                               2.49.0
Bottleneck                         1.3.2
brotlipy                           0.7.0
cached-property                    1.5.2
cachetools                         5.2.0
certifi                            2021.10.8
cffi                               1.14.6
chardet                            4.0.0
charset-normalizer                 2.0.4
click                              8.0.3
cloudpickle                        2.0.0
clyent                             1.2.2
colorama                           0.4.4
comtypes                           1.1.10
conda                              4.10.3
conda-build                        3.21.6
conda-content-trust                0+unknown
conda-pack                         0.6.0
conda-package-handling             1.7.3
conda-repo-cli                     1.0.4
conda-token                        0.3.0
conda-verify                       3.4.2
contextlib2                        0.6.0.post1
cookiecutter                       1.7.2
cryptography                       3.4.8
cycler                             0.10.0
Cython                             0.29.24
cytoolz                            0.11.0
daal4py                            2021.3.0
dask                               2021.10.0
debugpy                            1.4.1
decorator                          5.1.0
defusedxml                         0.7.1
diff-match-patch                   20200713
distributed                        2021.10.0
docutils                           0.17.1
ecdsa                              0.18.0
einops                             0.4.1
entrypoints                        0.3
et-xmlfile                         1.1.0
executing                          0.8.2
fastcache                          1.1.0
filelock                           3.3.1
flake8                             3.9.2
Flask                              1.1.2
fonttools                          4.25.0
frozenlist                         1.3.0
fsspec                             2021.10.1
ftfy                               6.1.1
future                             0.18.2
gevent                             21.8.0
glob2                              0.7
google-auth                        2.6.6
google-auth-oauthlib               0.4.6
greenlet                           1.1.1
grpcio                             1.46.3
h11                                0.13.0
h5py                               3.2.1
HeapDict                           1.0.1
html5lib                           1.1
idna                               3.2
imagecodecs                        2021.8.26
imageio                            2.9.0
imagesize                          1.2.0
importlib-metadata                 4.8.1
inflection                         0.5.1
iniconfig                          1.1.1
intervaltree                       3.1.0
ipykernel                          6.4.1
ipython                            7.29.0
ipython-genutils                   0.2.0
ipywidgets                         7.6.5
isort                              5.9.3
itsdangerous                       2.0.1
jdcal                              1.4.1
jedi                               0.18.0
Jinja2                             2.11.3
jinja2-time                        0.2.0
joblib                             1.1.0
json5                              0.9.6
jsonschema                         4.4.0
jupyter                            1.0.0
jupyter-client                     6.1.12
jupyter-console                    6.4.0
jupyter-core                       4.9.1
jupyter-server                     1.4.1
jupyterlab                         3.2.1
jupyterlab-pygments                0.1.2
jupyterlab-server                  2.8.2
jupyterlab-widgets                 1.0.0
keyring                            23.1.0
kiwisolver                         1.3.1
lazy-object-proxy                  1.6.0
libarchive-c                       2.9
llvmlite                           0.37.0
locket                             0.2.1
lpips                              0.1.4
lxml                               4.6.3
Markdown                           3.3.7
MarkupSafe                         1.1.1
matplotlib                         3.4.3
matplotlib-inline                  0.1.2
mccabe                             0.6.1
menuinst                           1.4.18
mistune                            0.8.4
mkl-fft                            1.3.1
mkl-random                         1.2.2
mkl-service                        2.4.0
mock                               4.0.3
more-itertools                     8.10.0
mpmath                             1.2.1
msgpack                            1.0.2
multidict                          6.0.2
multipledispatch                   0.6.0
munkres                            1.1.4
mypy-extensions                    0.4.3
navigator-updater                  0.2.1
nbclassic                          0.2.6
nbclient                           0.5.3
nbconvert                          6.1.0
nbformat                           5.1.3
nest-asyncio                       1.5.4
networkx                           2.6.3
nltk                               3.6.5
nnAudio                            0.3.1
nose                               1.3.7
notebook                           6.4.5
numba                              0.54.1
numexpr                            2.7.3
numpy                              1.20.3
numpydoc                           1.1.0
oauthlib                           3.2.0
olefile                            0.46
omegaconf                          2.2.2
openpyxl                           3.0.9
outcome                            1.2.0
packaging                          21.0
pandas                             1.3.4
pandocfilters                      1.4.3
paramiko                           2.7.2
parso                              0.8.3
partd                              1.2.0
path                               16.0.0
pathlib2                           2.3.6
pathspec                           0.9.0
patsy                              0.5.2
pep8                               1.7.1
pexpect                            4.8.0
pickleshare                        0.7.5
Pillow                             8.4.0
pip                                21.2.4
pkginfo                            1.7.1
platformdirs                       2.5.0
pluggy                             0.13.1
ply                                3.11
poyo                               0.5.0
progressbar                        2.5
prometheus-client                  0.11.0
prompt-toolkit                     3.0.20
protobuf                           3.20.0
psutil                             5.8.0
ptyprocess                         0.7.0
pure-eval                          0.2.2
py                                 1.10.0
pyasn1                             0.4.8
pyasn1-modules                     0.2.8
pycodestyle                        2.7.0
pycosat                            0.6.3
pycparser                          2.21
pycurl                             7.44.1
pyDeprecate                        0.3.2
pydocstyle                         6.1.1
pyerfa                             2.0.0
pyflakes                           2.3.1
Pygments                           2.10.0
PyJWT                              2.1.0
pylint                             2.9.6
pyls-spyder                        0.4.0
PyNaCl                             1.4.0
pyodbc                             4.0.0-unsupported
pyOpenSSL                          21.0.0
pyparsing                          3.0.7
pyreadline                         2.1
pyrsistent                         0.18.1
PySocks                            1.7.1
pytest                             6.2.4
python-dateutil                    2.8.2
python-jose                        3.3.0
python-lsp-black                   1.0.0
python-lsp-jsonrpc                 1.0.0
python-lsp-server                  1.2.4
python-slugify                     5.0.2
pytorch-lightning                  1.6.4
pytz                               2021.3
PyWavelets                         1.1.1
pywin32                            303
pywin32-ctypes                     0.2.0
pywinpty                           0.5.7
PyYAML                             6.0
pyzmq                              22.3.0
QDarkStyle                         3.0.2
qstylizer                          0.1.10
QtAwesome                          1.0.2
qtconsole                          5.1.1
QtPy                               1.10.0
regex                              2021.8.3
requests                           2.27.1
requests-oauthlib                  1.3.1
rope                               0.19.0
rsa                                4.8
Rtree                              0.9.7
ruamel-yaml-conda                  0.15.100
scikit-image                       0.18.3
scikit-learn                       0.24.2
scikit-learn-intelex               2021.20210714.120553
scipy                              1.7.1
seaborn                            0.11.2
selenium                           4.3.0
selenium-stealth                   1.0.6
Send2Trash                         1.8.0
setuptools                         58.0.4
simplegeneric                      0.8.1
singledispatch                     3.7.0
sip                                4.19.13
six                                1.16.0
sniffio                            1.2.0
snowballstemmer                    2.1.0
sortedcollections                  2.1.0
sortedcontainers                   2.4.0
soupsieve                          2.2.1
Sphinx                             4.2.0
sphinxcontrib-applehelp            1.0.2
sphinxcontrib-devhelp              1.0.2
sphinxcontrib-htmlhelp             2.0.0
sphinxcontrib-jsmath               1.0.1
sphinxcontrib-qthelp               1.0.3
sphinxcontrib-serializinghtml      1.1.5
sphinxcontrib-websupport           1.2.4
spyder                             5.1.5
spyder-kernels                     2.1.3
SQLAlchemy                         1.4.22
statsmodels                        0.12.2
sympy                              1.9
tables                             3.6.1
taming-transformers-rom1504        0.0.6
TBB                                0.2
tblib                              1.7.0
tensorboard                        2.9.0
tensorboard-data-server            0.6.1
tensorboard-plugin-wit             1.8.1
terminado                          0.9.4
testpath                           0.5.0
text-unidecode                     1.3
textdistance                       4.2.1
threadpoolctl                      2.2.0
three-merge                        0.1.1
tifffile                           2021.7.2
timm                               0.5.4
tinycss                            0.4
toml                               0.10.2
tomli                              2.0.1
toolz                              0.11.1
torch                              1.11.0+cu113
torchaudio                         0.11.0+cu113
torchmetrics                       0.9.1
torchvision                        0.12.0+cu113
tornado                            6.1
tqdm                               4.62.3
traitlets                          5.1.1
trio                               0.21.0
trio-websocket                     0.9.2
typed-ast                          1.4.3
typing_extensions                  4.0.1
ujson                              4.0.2
unicodecsv                         0.14.1
Unidecode                          1.2.0
urllib3                            1.26.9
vector-quantize-pytorch            0.8.1
watchdog                           2.1.3
wcwidth                            0.2.5
webencodings                       0.5.1
Werkzeug                           2.0.2
wheel                              0.37.0
whichcraft                         0.6.1
widgetsnbextension                 3.5.1
win-inet-pton                      1.1.0
win-unicode-console                0.5
wincertstore                       0.2
wrapt                              1.12.1
wsproto                            1.1.0
xlrd                               2.0.1
XlsxWriter                         3.0.1
xlwings                            0.24.9
xlwt                               1.3.0
xmltodict                          0.12.0
yapf                               0.31.0
yarl                               1.7.2
zict                               2.0.0
zipp                               3.6.0
zope.event                         4.5.0
zope.interface                     5.4.0

@HandsomeDevilv112
Copy link
Author

GOT IT, COACH
I'm pretty new to the anaconda environments game.
So, I was editing "/home/al/tortoise-tts/tortoise/models/diffusion_decoder.py" instead of what the error was actually pointing at.
"/home/al/.local/lib/python3.8/site-packages/TorToiSe-2.4.2-py3.8.egg/tortoise/models/diffusion_decoder.py"
Why it lives there, specifically, is beyond me.

During my wild goose chase, I determined that we are running the same versions of torch, torchvision, and torchaudio. Where/why it gets stuck is, again, past my realm of understanding.

@neonbjb
Copy link
Owner

neonbjb commented Sep 13, 2022

Ah yes, if you python setup.py install it, this happens. If you wish to install it but also do work on it, you should be able to do pip install -e ..

I'm also quite bad at Python packages. Most of what I know is hard-learned in the vein of what you've done here. Cheers! :)

@HandsomeDevilv112
Copy link
Author

I'm self-taught, so all of my learning has gone through this method.
Speaking of, the next trick is going to be getting my Hulk Hogan to sound like him instead of Sir Hammerlock.
https://drive.google.com/drive/u/0/folders/1VKP_3r56JVeOc6rdk-AWz9eAkG5WJOTK
I think I'm not properly following "Run tortoise utilities with --voice=<your_subdirectory_name>.", as I'm not quite sure what tortoise-tts.py is asking me to do. I'll try again after work.

@neonbjb
Copy link
Owner

neonbjb commented Sep 14, 2022

:)

Can't help myself, because patrick stewart is one of the models I have fine-tuned:

https://drive.google.com/file/d/1zg8o7Dfmr3d2I2_a6U2bonE-PaQvgKwi/view?usp=sharing

@HandsomeDevilv112
Copy link
Author

and I can't blame you! That sounds brilliant! I spent some time regenerating samples to get that much.
I look forward to to getting Hulk Hogan to read Shakespearean sonnets, BROTHER

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