question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] ValueError: `Field` default cannot be set in `Annotated` for 'num_Annotated[str, FieldInfo(min_length=1, extra={})]'

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
p0p4kcommented, Aug 1, 2022

That worked! Thank you!

Added pull request in #1809 .

1reaction
p0p4kcommented, Aug 1, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

ValueError: `Field` default cannot be set in `Annotated` for ...
I don't think this is really a bug per-say. When you create the Annotated , it can't be treated as being "just" a...
Read more >
pydantic setting a default value for an annotated type
but I get this error: E ValueError: Field default cannot be set in Annotated for 'post_steps_0'. I think I am misunderstanding how the ......
Read more >
`Field` default cannot be set in `Annotated` for (field_name!r)
[Read fixes] Steps to fix this pydantic exception: ... Full details: ValueError: `Field` default cannot be set in `Annotated` for (field_name!r)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found