tensorflow io_error ai_generated true

tensorflow.python.framework.errors_impl.NotFoundError: Unsuccessful TensorSliceReader: Failed to get matching files on /path/to/model/checkpoint

ID: tensorflow/checkpoint-not-found

Also available as: JSON · Markdown
85%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
2 active

Root Cause

Checkpoint file missing, path wrong, or only partial checkpoint files present (missing .index or .data).

generic

Workarounds

  1. 92% success Verify all checkpoint files exist
    ls model_dir/  # must have: checkpoint, model.ckpt.index, model.ckpt.data-00000-of-00001

    Sources: https://www.tensorflow.org/guide/gpu

  2. 88% success Use tf.train.latest_checkpoint() to find the correct path
    ckpt_path = tf.train.latest_checkpoint('model_dir/'); model.load_weights(ckpt_path)
  3. 82% success Use SavedModel format instead of checkpoints for portability
    model.save('saved_model_dir')  # saves full model; tf.saved_model.load('saved_model_dir')

Dead Ends

Common approaches that don't work:

  1. Download only the .ckpt file without .index and .data-00000-of-00001 90% fail

    TF checkpoints are split into 3 files (.index, .data-00000-of-00001, checkpoint). All are required.

  2. Change file extension from .ckpt to .h5 or vice versa 92% fail

    These are completely different formats. .ckpt is TF-native, .h5 is HDF5. They are not interchangeable by renaming.