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/mobiledet.py:323

  Args:
    specs: A `dict` specification of block specs of a mobiledet version.
    filter_size_scale: A `float` multiplier for the filter size for all
      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.

  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))

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

  decoded_specs = []

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

  for ds in decoded_specs:
    if ds.filters:
      ds.filters = nn_layers.round_filters(filters=ds.filters,
                                           multiplier=filter_size_scale,
                                           divisor=divisible_by,
                                           round_down_protect=False,

View on GitHub (pinned to e006f5f0d5)

Solutions

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

When it happens

Trigger: Thrown at official/vision/modeling/backbones/mobiledet.py:323 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/828d250ecaa8f68b. Report an issue: GitHub.