{"record":{"id":"7e5c281a53b3d229","repo":"tensorflow/models","slug":"do-not-have-sample-info","errorCode":null,"errorMessage":"Do not have sample info.","messagePattern":"Do not have sample info\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/xlnet/data_utils.py","lineNumber":612,"sourceCode":"  # than passing dataset instance itself.\n  use_dataset_fn = isinstance(strategy, tf.distribute.TPUStrategy)\n  split = \"train\"\n  bsz_per_host = int(batch_size / num_hosts)\n  record_glob_base = format_filename(\n      prefix=\"meta.{}.pass-*\".format(split),\n      suffix=\"json*\",\n      bsz_per_host=bsz_per_host,\n      seq_len=seq_len,\n      reuse_len=reuse_len,\n      uncased=uncased)\n\n  def _get_num_batch(info):\n    if \"num_batch\" in info:\n      return info[\"num_batch\"]\n    elif \"num_example\" in info:\n      return info[\"num_example\"] / bsz_per_host\n    else:\n      raise ValueError(\"Do not have sample info.\")\n\n  if use_dataset_fn:\n    if batch_size % strategy.num_replicas_in_sync != 0:\n      raise ValueError(\n          \"Batch size must be divisible by number of replicas : {}\".format(\n              strategy.num_replicas_in_sync))\n\n    # As auto rebatching is not supported in\n    # `distribute_datasets_from_function()` API, which is\n    # required when cloning dataset to multiple workers in eager mode,\n    # we use per-replica batch size.\n    batch_size = int(batch_size / strategy.num_replicas_in_sync)\n\n  record_info = {\"num_batch\": 0, \"filenames\": []}\n\n  tfrecord_dirs = file_path.split(\",\")\n  logging.info(\"Use the following tfrecord dirs: %s\", tfrecord_dirs)\n","sourceCodeStart":594,"sourceCodeEnd":630,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/xlnet/data_utils.py#L594-L630","documentation":"Error \"Do not have sample info.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/xlnet/data_utils.py:612 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"}