{"record":{"id":"bbd3755efa777852","repo":"tensorflow/models","slug":"dataset-must-specify-a-path-for-the-data-files","errorCode":null,"errorMessage":"Dataset must specify a path for the data files.","messagePattern":"Dataset must specify a path for the data files\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/image_classification/dataset_factory.py","lineNumber":367,"sourceCode":"        interleave_cycle_length=10,\n        interleave_block_length=1,\n        input_context=self.input_context)\n\n    dataset = builder.as_dataset(\n        split=self.config.split,\n        as_supervised=True,\n        shuffle_files=True,\n        decoders=decoders,\n        read_config=read_config)\n\n    return dataset\n\n  def load_records(self) -> tf.data.Dataset:\n    \"\"\"Return a dataset loading files with TFRecords.\"\"\"\n    logging.info('Using TFRecords to load data.')\n    if self.config.filenames is None:\n      if self.config.data_dir is None:\n        raise ValueError('Dataset must specify a path for the data files.')\n\n      file_pattern = os.path.join(self.config.data_dir,\n                                  '{}*'.format(self.config.split))\n      dataset = tf.data.Dataset.list_files(file_pattern, shuffle=False)\n    else:\n      dataset = tf.data.Dataset.from_tensor_slices(self.config.filenames)\n\n    return dataset\n\n  def load_synthetic(self) -> tf.data.Dataset:\n    \"\"\"Return a dataset generating dummy synthetic data.\"\"\"\n    logging.info('Generating a synthetic dataset.')\n\n    def generate_data(_):\n      image = tf.zeros([self.image_size, self.image_size, self.num_channels],\n                       dtype=self.dtype)\n      label = tf.zeros([1], dtype=tf.int32)\n      return image, label","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/image_classification/dataset_factory.py#L349-L385","documentation":"Error \"Dataset must specify a path for the data files.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/image_classification/dataset_factory.py:367 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"}