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] ValueError: Field default cannot be set in Annotated for 'num_Annotated[str, FieldInfo(min_length=1, extra={})]' #1808

Closed
GanerCodes opened this issue Aug 1, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@GanerCodes
Copy link

Describe the bug

Failes to output anything. Using python 3.10.5 on Gentoo and tried installing from pip and locally.

Command: tts --text "this is a test" --out_path /tmp/outtest.wav

To Reproduce

Just installing and running, at least for me

Expected behavior

No response

Logs

$ tts --text "this is a test" --out_path /tmp/outtest.wav
 > tts_models/en/ljspeech/tacotron2-DDC is already downloaded.
 > vocoder_models/en/ljspeech/hifigan_v2 is already downloaded.
 > Using model: Tacotron2
Traceback (most recent call last):
  File "/home/ganer/.local/bin/tts", line 33, in <module>
    sys.exit(load_entry_point('TTS', 'console_scripts', 'tts')())
  File "/home/ganer/Programs/TTS/TTS/bin/synthesize.py", line 309, in main
    synthesizer = Synthesizer(
  File "/home/ganer/Programs/TTS/TTS/utils/synthesizer.py", line 76, in __init__
    self._load_tts(tts_checkpoint, tts_config_path, use_cuda)
  File "/home/ganer/Programs/TTS/TTS/utils/synthesizer.py", line 113, in _load_tts
    self.tts_model = setup_tts_model(config=self.tts_config)
  File "/home/ganer/Programs/TTS/TTS/tts/models/__init__.py", line 12, in setup_model
    MyModel = find_module("TTS.tts.models", config.model.lower())
  File "/home/ganer/Programs/TTS/TTS/utils/generic_utils.py", line 93, in find_module
    module = importlib.import_module(module_path + "." + module_name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/ganer/Programs/TTS/TTS/tts/models/tacotron2.py", line 13, in <module>
    from TTS.tts.models.base_tacotron import BaseTacotron
  File "/home/ganer/Programs/TTS/TTS/tts/models/base_tacotron.py", line 14, in <module>
    from TTS.tts.utils.text.tokenizer import TTSTokenizer
  File "/home/ganer/Programs/TTS/TTS/tts/utils/text/__init__.py", line 1, in <module>
    from TTS.tts.utils.text.tokenizer import TTSTokenizer
  File "/home/ganer/Programs/TTS/TTS/tts/utils/text/tokenizer.py", line 3, in <module>
    from TTS.tts.utils.text import cleaners
  File "/home/ganer/Programs/TTS/TTS/tts/utils/text/cleaners.py", line 11, in <module>
    from .english.number_norm import normalize_numbers as en_normalize_numbers
  File "/home/ganer/Programs/TTS/TTS/tts/utils/text/english/number_norm.py", line 6, in <module>
    import inflect
  File "/home/ganer/.local/lib/python3.10/site-packages/inflect/__init__.py", line 2046, in <module>
    class engine:
  File "/home/ganer/.local/lib/python3.10/site-packages/inflect/__init__.py", line 3781, in engine
    def number_to_words(  # noqa: C901
  File "pydantic/decorator.py", line 36, in pydantic.decorator.validate_arguments.validate
    import sys
  File "pydantic/decorator.py", line 126, in pydantic.decorator.ValidatedFunction.__init__
    try:
  File "pydantic/decorator.py", line 259, in pydantic.decorator.ValidatedFunction.create_model
    return fun
  File "pydantic/main.py", line 972, in pydantic.main.create_model
  File "pydantic/main.py", line 204, in pydantic.main.ModelMetaclass.__new__
  File "pydantic/fields.py", line 488, in pydantic.fields.ModelField.infer
  File "pydantic/fields.py", line 419, in pydantic.fields.ModelField.__init__
  File "pydantic/fields.py", line 534, in pydantic.fields.ModelField.prepare
  File "pydantic/fields.py", line 633, in pydantic.fields.ModelField._type_analysis
  File "pydantic/fields.py", line 776, in pydantic.fields.ModelField._create_sub_type
  File "pydantic/fields.py", line 451, in pydantic.fields.ModelField._get_field_info
ValueError: `Field` default cannot be set in `Annotated` for 'num_Annotated[str, FieldInfo(min_length=1, extra={})]'


### Environment

```shell
{
    "CUDA": {
        "GPU": [],
        "available": false,
        "version": "10.2"
    },
    "Packages": {
        "PyTorch_debug": false,
        "PyTorch_version": "1.12.0+cu102",
        "TTS": "0.7.1",
        "numpy": "1.22.4"
    },
    "System": {
        "OS": "Linux",
        "architecture": [
            "64bit",
            "ELF"
        ],
        "processor": "AMD Ryzen 7 3800X 8-Core Processor",
        "python": "3.10.5",
        "version": "#1 SMP PREEMPT_DYNAMIC Sat Jul 30 02:33:52 CDT 2022"
    }
}

Additional context

No response

@GanerCodes GanerCodes added the bug Something isn't working label Aug 1, 2022
@p0p4k
Copy link
Contributor

p0p4k commented Aug 1, 2022

Post your pip list output. Thanks.

@GanerCodes
Copy link
Author

Package                       Version           Editable project location
----------------------------- ----------------- -----------------------------------------------
aiohttp                       3.8.1
aiosignal                     1.2.0
alabaster                     0.7.12
ansiwrap                      0.8.4
antlr4-python3-runtime        4.7.2
anyascii                      0.3.1
appdirs                       1.4.4
argcomplete                   2.0.0
arrow                         1.2.2
astroid                       2.7.3
async-timeout                 4.0.2
attrs                         21.4.0
audioread                     2.1.9
audiotsm                      0.1.2
autokey                       0.95.4
autopep8                      1.6.0
Babel                         2.10.3
bandwidth-sdk                 12.0.0
beniget                       0.4.1
bidict                        0.22.0
black                         22.3.0
blessed                       1.19.1
bokeh                         1.4.0
Brotli                        1.0.9
bytecode                      0.13.0
CacheControl                  0.12.6
cefpython3                    66.0
certifi                       2020.12.5
certifi-system-store          3021.3.16
cffi                          1.14.5
chardet                       4.0.0
charset-normalizer            2.1.0
click                         8.0.0
clipboard                     0.0.4
colorlog                      6.6.0
configparser                  5.0.2
console-menu                  0.7.1
coqpit                        0.0.16
coverage                      6.4.2
cryptocmd                     0.6.1
cryptography                  3.4.7
cycler                        0.11.0
Cython                        0.29.28
dateparser                    1.1.1
dbus-python                   1.2.18
decorator                     5.1.1
dill                          0.3.4
discord.py                    1.7.3
distro                        1.7.0
docopt                        0.6.2
docutils                      0.18.1
editables                     0.3
electron-inject               0.7
enum34                        1.1.10
et-xmlfile                    1.1.0
evdev                         1.5.0
Faker                         13.11.0
ffmpeg-python                 0.2.0
ffprobe-python                1.0.3
fishhook                      0.1.4
flake8                        4.0.1
Flask                         2.0.0
Flask-SocketIO                5.1.2
flit_core                     3.7.1
flyingcircus                  0.1.4.0
fonttools                     4.33.3
fqdn                          1.5.1
frozenlist                    1.3.0
fsspec                        2022.7.1
future                        0.18.2
gast                          0.5.3
gdbus_codegen                 2.72.3
gemato                        16.2
gentoolkit                    0.6.1.post3
glcontext                     2.3.6
gpg                           1.17.1
gruut                         2.2.3
gruut-ipa                     0.13.0
gruut-lang-cs                 2.0.0
gruut-lang-de                 2.0.0
gruut-lang-en                 2.0.0
gruut-lang-es                 2.0.0
gruut-lang-fr                 2.0.2
gruut-lang-it                 2.0.0
gruut-lang-nl                 2.0.2
gruut-lang-pt                 2.0.0
gruut-lang-ru                 2.0.0
gruut-lang-sv                 2.0.0
hatch-vcs                     0.2.0
hatchling                     1.6.0
Historic-Crypto               0.1.6
idna                          2.10
imagesize                     1.4.1
importlib_metadata            4.12.0
inflect                       6.0.0
installer                     0.5.1
isoduration                   20.11.0
isort                         5.10.1
itsdangerous                  2.0.1
jaraco.context                4.1.2
jaraco.functools              3.5.1
jaraco.text                   3.8.1
java-config                   2.3.1
javatoolkit                   0.5.0
jedi                          0.18.1
jeepney                       0.8.0
jieba                         0.42.1
Jinja2                        3.0.1
joblib                        1.1.0
jsonlines                     1.2.0
jsonpickle                    0.9.6
jsonpointer                   2.3
jsonschema                    4.8.0
jwt                           1.2.0
keyboard                      0.13.5
keyring                       23.7.0
kiwisolver                    1.4.2
layman                        2.4.3
lazy-object-proxy             1.7.1
libevdev                      0.10
librosa                       0.8.0
libsixel-python               0.5.1
libvirt-python                8.3.0
llvmlite                      0.38.0
lutris                        0.5.10.1
lxml                          4.6.3
M2Crypto                      0.38.0
Mako                          1.2.1
MarkupSafe                    2.0.1
matplotlib                    3.5.2
mccabe                        0.6.1
mecab-python3                 1.0.5
meson                         0.62.1
meson-python                  0.8.1
mistune                       2.0.2
moderngl                      5.6.4
moderngl-window               2.4.1
more-itertools                8.13.0
MouseInfo                     0.1.3
mpmath                        1.2.1
msgpack                       1.0.2
multidict                     6.0.2
multipledispatch              0.6.0
mutagen                       1.45.1
mypy                          0.971
mypy-extensions               0.4.3
netlink                       1.0
networkx                      2.8.5
nose2                         0.12.0
nspektr                       0.4.0
num2words                     0.5.10
numba                         0.55.2
numpy                         1.22.4
olefile                       0.46
openpyxl                      3.0.9
openrgb-python                0.2.15
ordered-set                   4.1.0
packaging                     21.3
pandas                        1.4.2
parso                         0.8.3
pathspec                      0.9.0
perlin-noise                  1.12
pexpect                       4.8.0
Pillow                        9.1.0
pip                           22.2.1
pip-review                    1.1.1
platformdirs                  2.5.2
pluggy                        1.0.0
ply                           3.11
pooch                         1.6.0
portage                       3.0.34
prompt-toolkit                3.0.29
protobuf                      3.19.4
protontricks                  1.9.0
proxy-tools                   0.1.0
psutil                        5.9.0
ptyprocess                    0.7.0
py-spy                        0.3.11
pyalsa                        1.2.7
PyAutoGUI                     0.9.53
pybind11                      2.10.0
pycairo                       1.21.0
pycodestyle                   2.8.0
pycollada                     0.7.2
pycparser                     2.20
pycryptodome                  3.15.0
pycryptodomex                 3.14.1
pycups                        2.0.1
pydantic                      1.9.0
pydbus                        0.6.0
pydocstyle                    6.1.1
pydub                         0.25.1
pyelftools                    0.28
pyflakes                      2.4.0
PyGetWindow                   0.0.9
pyglet                        1.5.26
Pygments                      2.12.0
PyGObject                     3.42.1
pyhht                         0.1.0
pyinotify                     0.9.6
pyjson5                       1.6.1
pylibacl                      0.6.0
pylint                        2.10.2
PyMouse                       1.0
PyMsgBox                      1.0.9
pynndescent                   0.5.7
pynput                        1.7.6
PyOpenGL                      3.1.6
pyparsing                     3.0.9
pyperclip                     1.8.2
pypinyin                      0.47.0
pyproject-metadata            0.6.1
Pypubsub                      4.0.3
PyQt-builder                  1.12.2
PyQt5                         5.15.6
PyQt5-Qt5                     5.15.2
PyQt5-sip                     12.11.0
PyQtWebEngine                 5.15.6
PyQtWebEngine-Qt5             5.15.2
PyRect                        0.2.0
pyrr                          0.10.3
pyrsistent                    0.18.1
pysbd                         0.3.4
PyScreeze                     0.1.28
pyserial                      3.5
PySocks                       1.7.1
python-appimage               1.0.2
python-crfsuite               0.9.8
python-dateutil               2.8.1
python-engineio               4.3.2
python-jsonrpc-server         0.4.0
python-language-server        0.36.2
python-lsp-jsonrpc            1.0.0
python-lsp-server             1.4.1
python-magic                  0.4.27
python-socketio               5.6.0
python-uinput                 0.11.2
python-xlib                   0.31
python3-xlib                  0.15
pythran                       0.11.0
pytk                          0.0.2.1
pytweening                    1.0.4
pytz                          2022.1
pytz-deprecation-shim         0.1.0.post0
pywebview                     3.6.3
pyworld                       0.2.10
PyYAML                        6.0
QtPy                          2.1.0
regex                         2022.3.2
requests                      2.25.1
resampy                       0.3.1
rfc3339-validator             0.1.4
rfc3986-validator             0.1.1
rfc3987                       1.3.8
rope                          1.0.0
Rtree                         1.0.0
samplerate                    0.1.0
sccontroller                  0.4.8.6
scikit-learn                  1.1.1
scipy                         1.8.0
screeninfo                    0.8
screenkey                     1.5
seccomp                       2.5.4
SecretStorage                 3.3.2
semantic-version              2.10.0
sentry-sdk                    1.9.0
setproctitle                  1.2.3
setuptools                    63.2.0
setuptools-rust               1.4.1
setuptools-scm                7.0.5
Shapely                       1.8.2
simplejson                    3.17.6
sip                           6.6.1
six                           1.16.0
smbus                         1.1
snowballstemmer               2.2.0
SoundFile                     0.10.3.post1
Sphinx                        5.1.1.dev20220729
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
sqlitedict                    2.0.0
ssl-fetch                     0.4
strict-rfc3339                0.7
svg.path                      6.2
svgpathtools                  1.5.1
svgwrite                      1.4.3
sympy                         1.10.1
tablib                        3.2.1
tensorboardX                  2.5.1
text-unidecode                1.3
textwrap3                     0.9.2
threadpoolctl                 3.1.0
toml                          0.10.2
tomli                         2.0.1
toolib                        0.1.1
torbrowser-launcher           0.3.5
torch                         1.12.0
torchaudio                    0.12.0
tornado                       6.2
tqdm                          4.64.0
trainer                       0.0.13
trimesh                       3.12.9
TTS                           0.7.1             /home/ganer/Programs/TTS
typed-ast                     1.4.3
typing_extensions             4.2.0
tzdata                        2022.1
tzlocal                       4.2
ujson                         5.2.0
umap-learn                    0.5.1
unidic-lite                   1.0.8
uri-template                  1.2.0
urllib3                       1.26.4
vdf                           3.4
vidcutter                     6.0.5.1
wcwidth                       0.2.5
webcolors                     1.12
websocket-client              1.3.2
websockets                    10.3
Werkzeug                      2.0.1
wheel                         0.37.1
wrapt                         1.12.1
wxPython                      4.1.1
xonsh                         0.12.6            /home/ganer/.local/lib/python3.10/site-packages
xontrib-argcomplete           0.3.2
xxhash                        3.0.0
yapf                          0.32.0
yarl                          1.7.2
yt-dlp                        2022.4.8
zipp                          3.8.1
zope.interface                5.4.0

@p0p4k
Copy link
Contributor

p0p4k commented Aug 1, 2022

Run the following in your terminal and report back.
pip uninstall inflect
pip install inflect==5.6.0
Good luck!

@GanerCodes
Copy link
Author

That worked! Thank you!

@p0p4k
Copy link
Contributor

p0p4k commented Aug 1, 2022

That worked! Thank you!

Added pull request in #1809 .

erogol pushed a commit that referenced this issue Aug 1, 2022
New inflect version (6.0) depends on pydantic which has some issues irrelevant to 🐸 TTS. #1808 
Force inflect==5.6 (pydantic free) install to solve dependency issue.
noranraskin pushed a commit to noranraskin/TTS that referenced this issue Aug 3, 2022
New inflect version (6.0) depends on pydantic which has some issues irrelevant to 🐸 TTS. coqui-ai#1808 
Force inflect==5.6 (pydantic free) install to solve dependency issue.
erogol added a commit that referenced this issue Aug 22, 2022
* Fix checkpointing GAN models (#1641)

* checkpoint sae step crash fix

* checkpoint save step crash fix

* Update gan.py

updated requested changes

* crash fix

* Fix the --model_name and --vocoder_name arguments need a <model_type> element (#1469)

Co-authored-by: Eren Gölge <[email protected]>

* Fix Publish CI (#1597)

* Try out manylinux

* temporary removal of useless pipeline

* remove check and use only manylinux

* Try --plat-name

* Add install requirements

* Add back other actions

* Add PR trigger

* Remove conditions

* Fix sythax

* Roll back some changes

* Add other python versions

* Add test pypi upload

* Add username

* Add back __token__ as username

* Modify name of entry to testpypi

* Set it to release only

* Fix version checking

* Fix tokenizer for punc only (#1717)

* Remove redundant config field

* Fix SSIM loss

* Separate loss tests

* Fix BCELoss adressing  #1192

* Make style

* Add durations as aux input for VITS (#1694)

* Add durations as aux input for VITS

* Make style

* Fix tts_tests

* Fix test_get_aux_input

* Make lint

* feat: updated recipes and lr fix (#1718)

- updated the recipes activating more losses for more stable training
- re-enabling guided attention loss
- fixed a bug about not the correct lr fetched for logging

* Implement VitsAudioConfig (#1556)

* Implement VitsAudioConfig

* Update VITS LJSpeech recipe

* Update VITS VCTK recipe

* Make style

* Add missing decorator

* Add missing param

* Make style

* Update recipes

* Fix test

* Bug fix

* Exclude tests folder

* Make linter

* Make style

* Fix device allocation

* Fix SSIM loss correction

* Fix aux tests (#1753)

* Set n_jobs to 1 for resample script

* Delete resample test

* Set n_jobs 1 in vad test

* delete vad test

* Revert "Delete resample test"

This reverts commit bb7c846.

* Remove tests with resample

* Fix for FloorDiv Function Warning (#1760)

* Fix for Floor Function Warning

Fix for Floor Function Warning

* Adding double quotes to fix formatting

Adding double quotes to fix formatting

* Update glow_tts.py

* Update glow_tts.py

* Fix type in download_vctk.sh (#1739)

typo in comment

* Update decoder.py (#1792)

Minor comment correction.

* Update requirements.txt (#1791)

Support for #1775

* Update README.md (#1776)

Fix typo in different and code sample

* Fix & update WaveRNN vocoder model (#1749)

* Fixes KeyError bug. Adding logging to dashboard.

* Make pep8 compliant

* Make style compliant

* Still fixing style

* Fix rand_segment edge case (input_len == seg_len - 1)

* Update requirements.txt; inflect==5.6 (#1809)

New inflect version (6.0) depends on pydantic which has some issues irrelevant to 🐸 TTS. #1808 
Force inflect==5.6 (pydantic free) install to solve dependency issue.

* Update README.md; download progress bar in CLI. (#1797)

* Update README.md

- minor PR
- added model_info usage guide based on #1623 in README.md .

* "added tqdm bar for model download"

* Update manage.py

* fixed style

* fixed style

* sort imports

* Update wavenet.py (#1796)

* Update wavenet.py

Current version does not use "in_channels" argument. 
In glowTTS, we use normalizing flows and so "input dim" == "ouput dim" (channels and length). So, the existing code just uses hidden_channel sized tensor as input to first layer as well as outputs hidden_channel sized tensor. 
However, since it is a generic implementation, I believe it is better to update it for a more general use.

* "in_channels -> hidden_channels"

* Adjust default to be able to process longer sentences (#1835)

Running `tts --text "$text" --out_path …` with a somewhat longer
sentences in the text will lead to warnings like “Decoder stopped with
max_decoder_steps 500” and the sentences just being cut off in the
resulting WAV file.

This happens quite frequently when feeding longer texts (e.g. a blog
post) to `tts`. It's particular frustrating since the error is not
always obvious in the output. You have to notice that there are missing
parts. This is something other users seem to have run into as well [1].

This patch simply increases the maximum number of steps allowed for the
tacotron decoder to fix this issue, resulting in a smoother default
behavior.

[1] mozilla/TTS#734

* Fix language flags generated by espeak-ng phonemizer (#1801)

* fix language flags generated by espeak-ng phonemizer

* Style

* Updated language flag regex to consider all language codes alike

* fix get_random_embeddings --> get_random_embedding (#1726)

* fix get_random_embeddings --> get_random_embedding

function typo leads to training crash, no such function

* fix typo

get_random_embedding

* Introduce numpy and torch transforms (#1705)

* Refactor audio processing functions

* Add tests for numpy transforms

* Fix imports

* Fix imports2

* Implement bucketed weighted sampling for VITS (#1871)

* Update capacitron_layers.py (#1664)

crashing because of dimension miss match   at line no. 57
[batch, 256] vs [batch , 1, 512]
enc_out = torch.cat([enc_out, speaker_embedding], dim=-1)

* updates to dataset analysis notebooks for compatibility with latest version of TTS (#1853)

* Fix BCE loss issue (#1872)

* Fix BCE loss issue

* Remove import

* Remove deprecated files (#1873)

- samplers.py is moved
- distribute.py is replaces by the 👟Trainer

* Handle when no batch sampler (#1882)

* Fix tune wavegrad (#1844)

* fix imports in tune_wavegrad

* load_config returns Coqpit object instead None

* set action (store true) for flag "--use_cuda"; start to tune if module is running as the main program

* fix var order in the result of batch collating

* make style

* make style with black and isort

* Bump up to v0.8.0

* Add new DE Thorsten models (#1898)

- Tacotron2-DDC
- HifiGAN vocoder

Co-authored-by: manmay nakhashi <[email protected]>
Co-authored-by: camillem <[email protected]>
Co-authored-by: WeberJulian <[email protected]>
Co-authored-by: a-froghyar <[email protected]>
Co-authored-by: ivan provalov <[email protected]>
Co-authored-by: Tsai Meng-Ting <[email protected]>
Co-authored-by: p0p4k <[email protected]>
Co-authored-by: Yuri Pourre <[email protected]>
Co-authored-by: vanIvan <[email protected]>
Co-authored-by: Lars Kiesow <[email protected]>
Co-authored-by: rbaraglia <[email protected]>
Co-authored-by: jchai.me <[email protected]>
Co-authored-by: Stanislav Kachnov <[email protected]>
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