tensorflow/models · error · ValueError
examples_per_group={self._examples_per_group} is larger than
Error message
examples_per_group={self._examples_per_group} is larger than the number of examples available in the local (per-device) batch_size={batch_size}. Either decrease examples_per_group or increase the batch_size. What it means
Error "examples_per_group={self._examples_per_group} is larger than the number of examples available in the local (per-device) batch_size={batch_size}. Either decrease examples_per_group or increase the batch_size." thrown in tensorflow/models.
Source
Thrown at official/nlp/modeling/layers/moe.py:588
<float>[batch_size, seq_length, hidden_dim].
training: Only apply dropout and jitter noise during training. If not
provided taken from tf_keras.backend.
Returns:
Transformed inputs with same shape as inputs:
<float>[batch_size, seq_length, hidden_dim].
Raises:
ValueError if we cannot find a group_size satisfying given requirements.
"""
if training is None:
training = tf_keras.backend.learning_phase()
# inputs shape [batch_size, seq_length, hidden_dim]
batch_size, seq_length, hidden_dim = inputs.shape
if batch_size is not None:
if self._examples_per_group > batch_size:
raise ValueError(
f"examples_per_group={self._examples_per_group} is larger than the "
"number of examples available in the local (per-device) batch_size="
f"{batch_size}. Either decrease examples_per_group or increase the "
"batch_size.")
tokens_per_group = int(seq_length * self._examples_per_group)
if training:
capacity_factor = self._train_capacity_factor
else:
capacity_factor = self._eval_capacity_factor
# Each group will send expert_capacity tokens to each expert.
expert_capacity = int(
round(capacity_factor * tokens_per_group / self.num_experts))
# Reshape batch and sequence/token dimensions for expert routing.
x = tf.reshape(inputs, (-1, tokens_per_group, hidden_dim))
x = self._mask_and_dispatch_to_experts(x, expert_capacity, training)View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/nlp/modeling/layers/moe.py:588 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/175e89a8c9a53130.
Report an issue: GitHub.