tensorflow/models · error · ValueError
Dataset must specify a path for the data files.
Error message
Dataset must specify a path for the data files.
What it means
Path guard in load_records: the TFRecords loader requires either config.filenames or config.data_dir to locate .tfrecord files, and both are None. The dataset config for the 'records' builder lacks any data location.
Solutions
- Set data_dir or filenames in the dataset config to point at the TFRecord files
- Switch builder to 'tfds' or 'synthetic' if no local records exist
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/legacy/image_classification/dataset_factory.py:367 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/bbd3755efa777852.
Report an issue: GitHub.
Appendix: source
Thrown at official/legacy/image_classification/dataset_factory.py:367
interleave_cycle_length=10,
interleave_block_length=1,
input_context=self.input_context)
dataset = builder.as_dataset(
split=self.config.split,
as_supervised=True,
shuffle_files=True,
decoders=decoders,
read_config=read_config)
return dataset
def load_records(self) -> tf.data.Dataset:
"""Return a dataset loading files with TFRecords."""
logging.info('Using TFRecords to load data.')
if self.config.filenames is None:
if self.config.data_dir is None:
raise ValueError('Dataset must specify a path for the data files.')
file_pattern = os.path.join(self.config.data_dir,
'{}*'.format(self.config.split))
dataset = tf.data.Dataset.list_files(file_pattern, shuffle=False)
else:
dataset = tf.data.Dataset.from_tensor_slices(self.config.filenames)
return dataset
def load_synthetic(self) -> tf.data.Dataset:
"""Return a dataset generating dummy synthetic data."""
logging.info('Generating a synthetic dataset.')
def generate_data(_):
image = tf.zeros([self.image_size, self.image_size, self.num_channels],
dtype=self.dtype)
label = tf.zeros([1], dtype=tf.int32)
return image, labelView on GitHub (pinned to e006f5f0d5)