{"record":{"id":"05456732d60f15b5","repo":"tensorflow/models","slug":"epochs-between-evals-1-not-supported-for-file-ba","errorCode":null,"errorMessage":"epochs_between_evals > 1 not supported for file based dataset.","messagePattern":"epochs_between_evals > 1 not supported for file based dataset\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/recommendation/data_pipeline.py","lineNumber":289,"sourceCode":"  def increment_request_epoch(self):\n    self._epochs_requested += 1\n\n  def get_dataset(self, batch_size, epochs_between_evals):\n    \"\"\"Construct the dataset to be used for training and eval.\n\n    For local training, data is provided through Dataset.from_generator. For\n    remote training (TPUs) the data is first serialized to files and then sent\n    to the TPU through a StreamingFilesDataset.\n\n    Args:\n      batch_size: The per-replica batch size of the dataset.\n      epochs_between_evals: How many epochs worth of data to yield. (Generator\n        mode only.)\n    \"\"\"\n    self.increment_request_epoch()\n    if self._stream_files:\n      if epochs_between_evals > 1:\n        raise ValueError(\"epochs_between_evals > 1 not supported for file \"\n                         \"based dataset.\")\n      epoch_data_dir = self._result_queue.get(timeout=300)\n      if not self._is_training:\n        self._result_queue.put(epoch_data_dir)  # Eval data is reused.\n\n      file_pattern = os.path.join(epoch_data_dir,\n                                  rconst.SHARD_TEMPLATE.format(\"*\"))\n      dataset = StreamingFilesDataset(\n          files=file_pattern,\n          worker_job=popen_helper.worker_job(),\n          num_parallel_reads=rconst.NUM_FILE_SHARDS,\n          num_epochs=1,\n          sloppy=not self._deterministic)\n      map_fn = functools.partial(\n          self.deserialize,\n          batch_size=batch_size,\n          is_training=self._is_training)\n      dataset = dataset.map(map_fn, num_parallel_calls=16)","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/recommendation/data_pipeline.py#L271-L307","documentation":"Raised by DataGenerator.get_dataset when epochs_between_evals > 1 while the pipeline is in file-based (remote/TPU StreamingFilesDataset) mode; multi-epoch streaming is only implemented for the local generator path.","triggerScenarios":"Thrown at official/recommendation/data_pipeline.py:289 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set epochs_between_evals to 1 when using file-based datasets","Keep the generator-based (local) data path if you need epochs_between_evals > 1","Drive multiple epochs from the training loop (repeat via steps) instead of the dataset construction"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}