invoke-ai/InvokeAI · error · NotImplementedError

Unknown variant: {variant}

Error message

Unknown variant: {variant}

What it means

calc_model_size_by_fs estimates a diffusers-format model's on-disk size by selecting the weight-file set matching the requested variant. Only '' (default), 'fp16', and '8bit' are recognized; anything else raises NotImplementedError. This guards against silently computing size from the wrong weight files when a new HF repo variant is added.

Source

Thrown at invokeai/backend/model_manager/model_util.py:149

    if not variant:  # ModelRepoVariant.DEFAULT evaluates to empty string for compatability with HF
        files = other_files
    elif variant == "fp16":
        files = fp16_files
    elif variant == "8bit":
        files = bit8_files
    else:
        raise NotImplementedError(f"Unknown variant: {variant}")

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Use only None/'' , 'fp16', or '8bit' as the variant when calling calc_model_size_by_fs.
  2. Check the string for typos or stray whitespace ('fp-16' vs 'fp16'); normalize/strip before calling.
  3. If you truly have a new variant, extend the function to classify its file names (add a set like bit8_files) instead of passing it through.
  4. Pass variant=None and let the function fall back to the default file set if you only need a rough size estimate.

Example fix

// before
calc_model_size_by_fs(path, subfolder, variant='fp32')
// after
calc_model_size_by_fs(path, subfolder, variant='fp16' if variant == 'fp32' else (variant or None))
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED_VARIANTS = {None, '', 'fp16', '8bit'}
if variant not in ALLOWED_VARIANTS:
    raise ValueError(f'Unsupported variant {variant!r}; expected one of fp16, 8bit, or None')
calc_model_size_by_fs(path, subfolder, variant)

Type guard

def is_supported_variant(v: object) -> bool:
    return v is None or v in ('', 'fp16', '8bit')

Try / catch

try:
    size = calc_model_size_by_fs(path, subfolder, variant)
except NotImplementedError as e:
    logger.warning(f'{e}; estimating from default file set')
    size = calc_model_size_by_fs(path, subfolder, None)

Prevention

When it happens

Trigger: Calling calc_model_size_by_fs(model_path, subfolder, variant) with a variant string other than None/''/'fp16'/'8bit' — e.g. 'fp32', 'bf16', 'openvino', or a typo like 'fp-16'.

Common situations: Passing a ModelRepoVariant enum value that was mapped to a new HF revision name; custom code or older persisted configs storing 'fp32'; upstream HF repos publishing variants InvokeAI's size calculator doesn't know about.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/fad04a4ba1dc161c. Report an issue: GitHub.