tensorflow/models · error · ValueError

`matched_files` should be a list or dict.

Error message

`matched_files` should be a list or dict.

What it means

Error "`matched_files` should be a list or dict." thrown in tensorflow/models.

Source

Thrown at official/core/input_reader.py:457

            tfds_name=self._tfds_name,
            tfds_data_dir=self._tfds_data_dir,
            tfds_split=self._tfds_split,
            tfds_skip_decoding_feature=self._tfds_skip_decoding_feature,
            tfds_as_supervised=self._tfds_as_supervised,
            input_context=input_context,
            seed=self._seed,
            is_training=self._is_training,
            cache=self._cache,
            cycle_length=self._cycle_length,
            block_length=self._block_length)
    elif isinstance(matched_files, (list, tuple)):
      dataset = _files_to_dataset(matched_files)
    elif isinstance(matched_files, dict):
      dataset = {}
      for k, fs in matched_files.items():
        dataset[k] = _files_to_dataset(fs)
    else:
      raise ValueError('`matched_files` should be a list or dict.')

    return dataset

  def _decode_and_parse_dataset(
      self,
      dataset: Union[tf.data.Dataset, Dict[Text, tf.data.Dataset]],
      batch_size: int,
      input_context: Optional[tf.distribute.InputContext] = None
  ) -> tf.data.Dataset:
    """Returns a tf.data.Dataset object after shuffling, decoding, and parsing."""

    def _shuffle_and_decode(ds):
      # If cache is enabled, we will call `shuffle()` later after `cache()`.
      if self._is_training and not self._cache:
        ds = ds.shuffle(self._shuffle_buffer_size, seed=self._seed)
      # Decode
      ds = _maybe_map_fn(ds, self._decoder_fn)
      return ds

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/core/input_reader.py:457 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/47868ef681c88cfb. Report an issue: GitHub.