{"record":{"id":"4e06529b3d55e089","repo":"tensorflow/models","slug":"the-seq-bucket-lengths-cannot-be-empty","errorCode":null,"errorMessage":"The seq_bucket_lengths cannot be empty.","messagePattern":"The seq_bucket_lengths cannot be empty\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/data/pretrain_dynamic_dataloader.py","lineNumber":65,"sourceCode":"@data_loader_factory.register_data_loader_cls(BertPretrainDataConfig)\nclass PretrainingDynamicDataLoader(pretrain_dataloader.BertPretrainDataLoader):\n  \"\"\"Dataset loader for bert-style pretraining with dynamic sequenece length.\n\n  Bucketizes the input id features by the seq_bucket_lengths and features are\n  padded to the bucket boundaries. The mask features are usually short than\n  input id features and can also be dynamic. We require the mask feature lengths\n  within a bucket must be the same. For example, with [128, 256] buckets,\n  the mask features for bucket 128 should always have the length as X and\n  features for bucket 256 should always have the length as Y.\n\n  The dataloader does not filter out empty masks. Make sure to handle this\n  in the model.\n  \"\"\"\n\n  def __init__(self, params):\n    self._params = params\n    if len(params.seq_bucket_lengths) < 1:\n      raise ValueError('The seq_bucket_lengths cannot be empty.')\n    self._seq_bucket_lengths = params.seq_bucket_lengths\n    self._seq_bucket_window_scale = params.seq_bucket_window_scale\n    self._global_batch_size = params.global_batch_size\n    self._use_next_sentence_label = params.use_next_sentence_label\n    self._use_position_id = params.use_position_id\n    self._drop_remainder = params.drop_remainder\n    self._enable_tf_data_service = params.enable_tf_data_service\n    self._enable_round_robin_tf_data_service = (\n        params.enable_round_robin_tf_data_service)\n    self._mask_keys = [\n        'masked_lm_positions', 'masked_lm_ids', 'masked_lm_weights'\n    ]\n\n  def _decode(self, record: tf.Tensor):\n    \"\"\"Decodes a serialized tf.Example.\"\"\"\n    name_to_features = {\n        'input_mask': tf.io.VarLenFeature(tf.int64),\n        'masked_lm_positions': tf.io.VarLenFeature(tf.int64),","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/data/pretrain_dynamic_dataloader.py#L47-L83","documentation":"Error \"The seq_bucket_lengths cannot be empty.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/data/pretrain_dynamic_dataloader.py:65 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"}