tensorflow/models · error · ValueError

The block spec cannot be empty for {} !

Error message

The block spec cannot be empty for {} !

What it means

Error "The block spec cannot be empty for {} !" thrown in tensorflow/models.

Source

Thrown at official/vision/modeling/backbones/mobilenet.py:1183

      convolution ops. The value must be greater than zero. Typical usage will
      be to set this value in (0, 1) to reduce the number of parameters or
      computation cost of the model.
    divisible_by: An `int` that ensures all inner dimensions are divisible by
      this number.
    finegrain_classification_mode: If True, the model will keep the last layer
      large even for small multipliers, following
      https://arxiv.org/abs/1801.04381.

  Returns:
    A list of `BlockSpec` that defines structure of the base network.
  """

  spec_name = specs['spec_name']
  block_spec_schema = specs['block_spec_schema']
  block_specs = specs['block_specs']

  if not block_specs:
    raise ValueError(
        'The block spec cannot be empty for {} !'.format(spec_name))

  for block_spec in block_specs:
    if len(block_spec) != len(block_spec_schema):
      raise ValueError(
          'The block spec values {} do not match with the schema {}'.format(
              block_spec, block_spec_schema
          )
      )

  decoded_specs = []

  for s in block_specs:
    kw_s = dict(zip(block_spec_schema, s))
    decoded_specs.append(BlockSpec(**kw_s))

  # This adjustment applies to V2, V3, and V4
  if (spec_name != 'MobileNetV1'

View on GitHub (pinned to e006f5f0d5)

Solutions

  1. Provide a non-empty block spec for the named block group in the MobileNet backbone config.
  2. Use a built-in MobileNet architecture (e.g. 'mobilenet_v2') instead of an empty custom spec.

When it happens

Trigger: Thrown at official/vision/modeling/backbones/mobilenet.py:1183 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/8732c70fdc551207. Report an issue: GitHub.