Skip to content

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

@GanerCodes

Description

@GanerCodes

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions