{"record":{"id":"6e110d4a06225df6","repo":"tensorflow/models","slug":"the-token-budget-global-batch-size-is-too-small","errorCode":null,"errorMessage":"The token budget, global batch size, is too small to yield 0 bucket window: %s","messagePattern":"The token budget, global batch size, is too small to yield 0 bucket window: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/data/wmt_dataloader.py","lineNumber":119,"sourceCode":"    batch_size: Max number of tokens per batch of examples.\n    max_length: Max number of tokens in an example input or target sequence.\n\n  Returns:\n    Dataset of batched examples with similar lengths.\n  \"\"\"\n  # Get min and max boundary lists for each example. These are used to calculate\n  # the `bucket_id`, which is the index at which:\n  # buckets_min[bucket_id] <= len(example) < buckets_max[bucket_id]\n  # Note that using both min and max lists improves the performance.\n  buckets_min, buckets_max = _create_min_max_boundaries(max_length)\n\n  # Create list of batch sizes for each bucket_id, so that\n  # bucket_batch_size[bucket_id] * buckets_max[bucket_id] <= batch_size\n  bucket_batch_sizes = [int(batch_size) // x for x in buckets_max]\n\n  # Validates bucket batch sizes.\n  if any([batch_size <= 0 for batch_size in bucket_batch_sizes]):\n    raise ValueError(\n        'The token budget, global batch size, is too small to yield 0 bucket '\n        'window: %s' % str(bucket_batch_sizes))\n\n  # bucket_id will be a tensor, so convert this list to a tensor as well.\n  bucket_batch_sizes = tf.constant(bucket_batch_sizes, dtype=tf.int64)\n\n  def example_to_bucket_id(example):\n    \"\"\"Return int64 bucket id for this example, calculated based on length.\"\"\"\n    example_input = example['inputs']\n    example_target = example['targets']\n    seq_length = _get_example_length((example_input, example_target))\n\n    conditions_c = tf.logical_and(\n        tf.less_equal(buckets_min, seq_length), tf.less(seq_length,\n                                                        buckets_max))\n    bucket_id = tf.reduce_min(tf.where(conditions_c))\n    return bucket_id\n","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/data/wmt_dataloader.py#L101-L137","documentation":"Error \"The token budget, global batch size, is too small to yield 0 bucket window: %s\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/data/wmt_dataloader.py:119 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}