tensorflow/models · error · ValueError

The batch size of pseudo-label dataset should not be larger

Error message

The batch size of pseudo-label dataset should not be larger than total global batch size.

What it means

Error "The batch size of pseudo-label dataset should not be larger than total global batch size." thrown in tensorflow/models.

Source

Thrown at official/vision/dataloaders/input_reader.py:115

     also less than 0.

  Returns:
    (labeled_batch_size, pseudo_labeled_batch_size) as ints.

  Raises:
    ValueError: If total_batch_size is negative, or both If pseudo_label_ratio
      is negative and pseudo-label global_batch_size is negative or larger than
      total batch size.
  """
  if total_batch_size < 0:
    raise ValueError('Invalid total_batch_size: {}'.format(total_batch_size))
  if pseudo_label_ratio >= 0.0:
    ratio_factor = pseudo_label_ratio / (1.0 + pseudo_label_ratio)
    pseudo_label_batch_size = int(total_batch_size * ratio_factor)
    label_batch_size = total_batch_size - pseudo_label_batch_size
  else:
    if pseudo_label_batch_size > total_batch_size or pseudo_label_batch_size < 0:
      raise ValueError(
          'The batch size of pseudo-label dataset should not be larger than '
          'total global batch size.')
    logging.info('data_ratio for pseudo-label dataset is less than 0. '
                 'Use global_batch_size from pseudo_label data config instead.')
    label_batch_size = total_batch_size - pseudo_label_batch_size
  return label_batch_size, pseudo_label_batch_size


class CombinationDatasetInputReader(input_reader.InputReader):
  """Combination dataset input reader."""

  def __init__(self,
               params: cfg.DataConfig,
               dataset_fn=tf.data.TFRecordDataset,
               pseudo_label_dataset_fn=tf.data.TFRecordDataset,
               decoder_fn: Optional[Callable[..., Any]] = None,
               combine_fn: Optional[Callable[..., Any]] = None,
               sample_fn: Optional[Callable[..., Any]] = None,

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/vision/dataloaders/input_reader.py:115 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/3414afa2ccea6794. Report an issue: GitHub.