tensorflow/models · error · ValueError

Unknown model name

Error message

Unknown model name {}

What it means

Lookup guard in EfficientNet.from_name: after merging MODEL_CONFIGS with any custom 'model_config' overrides, the requested model_name still has no entry, so no architecture config exists to construct the model.

Solutions

  1. Use a standard name like 'b0'...'l2' present in MODEL_CONFIGS
  2. Pass a model_config override in `overrides` defining the custom model_name
  3. Check for typos in the model_name argument
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at official/legacy/image_classification/efficientnet/efficientnet_model.py:485 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24). Data as JSON: /api/errors/a02ef6231feba940. Report an issue: GitHub.

Appendix: source

Thrown at official/legacy/image_classification/efficientnet/efficientnet_model.py:485

    Args:
      model_name: the predefined model name
      model_weights_path: the path to the weights (h5 file or saved model dir)
      weights_format: the model weights format. One of 'saved_model', 'h5', or
        'checkpoint'.
      overrides: (optional) a dict containing keys that can override config

    Returns:
      A constructed EfficientNet instance.
    """
    model_configs = dict(MODEL_CONFIGS)
    overrides = dict(overrides) if overrides else {}

    # One can define their own custom models if necessary
    model_configs.update(overrides.pop('model_config', {}))

    if model_name not in model_configs:
      raise ValueError('Unknown model name {}'.format(model_name))

    config = model_configs[model_name]

    model = cls(config=config, overrides=overrides)

    if model_weights_path:
      common_modules.load_weights(
          model, model_weights_path, weights_format=weights_format)

    return model

View on GitHub (pinned to e006f5f0d5)