EveryVoiceTTS / EveryVoice

The EveryVoice TTS Toolkit - Text To Speech for your language
https://docs.everyvoice.ca
Other
20 stars 2 forks source link

Friendlier message when using wrong config #114

Closed SamuelLarkin closed 6 months ago

SamuelLarkin commented 12 months ago

I wrongfully tried everyvoice preprocess config/everyvoice-shared-data.yaml and since I used the wrong config file I've got an unfriendly dump that doesn't help the user diagnoses the reason why it failed.

We should catch this and propose a solution to the user like suggesting that he might have invoked the command with the wrong config file.

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /fs/hestia_Hnrc/ict/sam037/git/EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightn │
│ ing/fs2/cli.py:159 in preprocess                                                                 │
│                                                                                                  │
│   156 ):                                                                                         │
│   157 │   from everyvoice.base_cli.helpers import preprocess_base_command                        │
│   158 │                                                                                          │
│ ❱ 159 │   preprocessor, config, processed = preprocess_base_command(                             │
│   160 │   │   model_config=FastSpeech2Config,  # type: ignore                                    │
│   161 │   │   steps=[step.name for step in steps],                                               │
│   162 │   │   **kwargs,                                                                          │
│                                                                                                  │
│ /fs/hestia_Hnrc/ict/sam037/git/EveryVoice/everyvoice/base_cli/helpers.py:70 in                   │
│ preprocess_base_command                                                                          │
│                                                                                                  │
│    67 ):                                                                                         │
│    68 │   from everyvoice.preprocessor import Preprocessor                                       │
│    69 │                                                                                          │
│ ❱  70 │   config = load_config_base_command(model_config, config_args, config_file)              │
│    71 │   preprocessor = Preprocessor(config)                                                    │
│    72 │   if isinstance(config, FastSpeech2Config) and config.model.use_phonological_feats:      │
│    73 │   │   steps.append("pfs")                                                                │
│                                                                                                  │
│ /fs/hestia_Hnrc/ict/sam037/git/EveryVoice/everyvoice/base_cli/helpers.py:49 in                   │
│ load_config_base_command                                                                         │
│                                                                                                  │
│    46 ):                                                                                         │
│    47 │   from everyvoice.utils import update_config_from_cli_args                               │
│    48 │                                                                                          │
│ ❱  49 │   config = model_config.load_config_from_path(config_file)                               │
│    50 │                                                                                          │
│    51 │   config = update_config_from_cli_args(config_args, config)                              │
│    52 │   return config                                                                          │
│                                                                                                  │
│ /fs/hestia_Hnrc/ict/sam037/git/EveryVoice/everyvoice/model/feature_prediction/FastSpeech2_lightn │
│ ing/fs2/config/__init__.py:170 in load_config_from_path                                          │
│                                                                                                  │
│   167 │   def load_config_from_path(path: Path) -> "FastSpeech2Config":                          │
│   168 │   │   """Load a config from a path"""                                                    │
│   169 │   │   config = load_config_from_json_or_yaml_path(path)                                  │
│ ❱ 170 │   │   return FastSpeech2Config(**config)                                                 │
│   171                                                                                            │
│                                                                                                  │
│ /home/sam037/.conda/envs/EveryVoice/lib/python3.9/site-packages/pydantic/main.py:165 in __init__ │
│                                                                                                  │
│    162 │   │   """                                                                               │
│    163 │   │   # `__tracebackhide__` tells pytest and some other tools to omit this function fr  │
│    164 │   │   __tracebackhide__ = True                                                          │
│ ❱  165 │   │   __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__p  │
│    166 │                                                                                         │
│    167 │   # The following line sets a flag that we use to determine when `__init__` gets overr  │
│    168 │   __init__.__pydantic_base_init__ = True                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValidationError: 10 validation errors for FastSpeech2Config
audio
  Extra inputs are not permitted [type=extra_forbidden, input_value={'alignment_bit_depth': 1...der_segment_size': 8192}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.3/v/extra_forbidden
dataset
  Extra inputs are not permitted [type=extra_forbidden, input_value='delme', input_type=str]
    For further information visit https://errors.pydantic.dev/2.3/v/extra_forbidden
dataset_split_seed
  Extra inputs are not permitted [type=extra_forbidden, input_value=1234, input_type=int]
    For further information visit https://errors.pydantic.dev/2.3/v/extra_forbidden
energy_phone_averaging
  Extra inputs are not permitted [type=extra_forbidden, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.3/v/extra_forbidden
pitch_phone_averaging
  Extra inputs are not permitted [type=extra_forbidden, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.3/v/extra_forbidden
pitch_type
  Extra inputs are not permitted [type=extra_forbidden, input_value='pyworld', input_type=str]
    For further information visit https://errors.pydantic.dev/2.3/v/extra_forbidden
save_dir
  Extra inputs are not permitted [type=extra_forbidden, input_value='../preprocessed', input_type=str]
    For further information visit https://errors.pydantic.dev/2.3/v/extra_forbidden
source_data
  Extra inputs are not permitted [type=extra_forbidden, input_value=[{'data_dir': '../../Comm...s': [['channel', '1']]}], input_type=list]
    For further information visit https://errors.pydantic.dev/2.3/v/extra_forbidden
train_split
  Extra inputs are not permitted [type=extra_forbidden, input_value=0.9, input_type=float]
    For further information visit https://errors.pydantic.dev/2.3/v/extra_forbidden
value_separator
  Extra inputs are not permitted [type=extra_forbidden, input_value='--', input_type=str]
    For further information visit https://errors.pydantic.dev/2.3/v/extra_forbidden
roedoejet commented 12 months ago

Thanks @SamuelLarkin - this is described in https://github.com/roedoejet/EveryVoice/issues/84 as well

SamuelLarkin commented 6 months ago

fixed by #277