babysor/MockingBird · error · ValueError

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

Error message

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

What it means

Identical logic to the ppg2mel copy: get_subsample in models/ppg_extractor/nets_utils.py rejects unsupported (mode, arch) pairs, e.g. anything besides asr/{vggblstmp,vggblstmp2,vggbgru,vgggru,bgru,blstmp,blstm} and mdense/bgru.

Source

Thrown at models/ppg_extractor/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

def get_activation(act):
    """Return activation function."""
    # Lazy load to avoid unused import
    from .encoder.swish import Swish

View on GitHub (pinned to 28dc5e14f1)

Solutions

  1. Match (mode, arch) to a supported combination, e.g. ('asr','vggblstmp')
  2. Patch get_subsample to add a branch for your arch if genuinely needed

Example fix

# before
get_subsample('asr', 'transformer', 24)

# 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

Prevention

When it happens

Trigger: Calling get_subsample with mode='asr' and an arch like 'conformer'/'transformer', or mode='mdense' with arch != 'bgru'.

Common situations: Adapting ESPnet2/conformer configs into this codebase; arch typo; wrong mode string.

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/36e8bfe198364249. Report an issue: GitHub.