babysor/MockingBird · error · ValueError

Invalid options: mode={}, arch={}

Error message

Invalid options: mode={}, arch={}

What it means

Raised by get_subsample in models/ppg2mel/utils/nets_utils.py when the (mode, arch) argument combination falls through all supported branches. Supported combos are mode='asr' with arch in {'vggblstmp','vggblstmp2','vggbgru','vgggru','bgru','blstmp','blstm'} (and similar), plus mode='mdense' with arch='bgru'; anything else is invalid.

Source

Thrown at models/ppg2mel/utils/nets_utils.py:439

    elif mode == 'asr' and arch == 'rnn_mulenc':
        subsample_list = []
        for idx in range(train_args.num_encs):
            subsample = np.ones(train_args.elayers[idx] + 1, dtype=np.int)
            if train_args.etype[idx].endswith("p") and not train_args.etype[idx].startswith("vgg"):
                ss = train_args.subsample[idx].split("_")
                for j in range(min(train_args.elayers[idx] + 1, len(ss))):
                    subsample[j] = int(ss[j])
            else:
                logging.warning(
                    'Encoder %d: Subsampling is not performed for vgg*. '
                    'It is performed in max pooling layers at CNN.', idx + 1)
            logging.info('subsample: ' + ' '.join([str(x) for x in subsample]))
            subsample_list.append(subsample)
        return subsample_list

    else:
        raise ValueError('Invalid options: mode={}, arch={}'.format(mode, arch))


def rename_state_dict(old_prefix: str, new_prefix: str, state_dict: Dict[str, torch.Tensor]):
    """Replace keys of old prefix with new prefix in state dict."""
    # need this list not to break the dict iterator
    old_keys = [k for k in state_dict if k.startswith(old_prefix)]
    if len(old_keys) > 0:
        logging.warning(f'Rename: {old_prefix} -> {new_prefix}')
    for k in old_keys:
        v = state_dict.pop(k)
        new_k = k.replace(old_prefix, new_prefix)
        state_dict[new_k] = v

View on GitHub (pinned to 28dc5e14f1)

Solutions

  1. Check the mode/arch values in your training config against the branches in get_subsample (models/ppg2mel/utils/nets_utils.py:~400-439)
  2. Fix typos in the arch string (case-sensitive, e.g. 'vggblstmp' not 'VGGBLSTMP')
  3. If you need conformer/transformer, patch get_subsample to handle the arch or use a supported arch

Example fix

# before
get_subsample('asr', 'conformer', 24)  # ValueError

# after
get_subsample('asr', 'vggblstmp', 24)
Defensive patterns

Strategy: validation

Validate before calling

VALID = {('asr', a) for a in ['vggblstmp','vggblstmp2','vggbgru','vgggru','bgru','blstmp','blstm']} | {('mdense','bgru')}
assert (mode, arch) in VALID, f'unsupported mode/arch: {mode}/{arch}'

Try / catch

try:
    subsample = get_subsample(mode, arch, num_layers)
except ValueError as e:
    raise ConfigError(f'Bad encoder arch in config: {e}') from e

Prevention

When it happens

Trigger: Calling get_subsample(mode, arch) with an unsupported arch string such as 'conformer' or 'transformer', or mode='mdense' with arch != 'bgru'.

Common situations: Copying an ESPnet config that uses an encoder arch this fork doesn't support; typos in the arch field of a train config YAML; switching from asr to mdense mode without changing arch.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of babysor/MockingBird@28dc5e14f1 (2026-08-27). Data as JSON: /api/errors/adac80fb1ca3ea9e. Report an issue: GitHub.