.ckpt has no single format. A PyTorch Lightning checkpoint is one file
written by torch.save, so its bytes are those of a
PyTorch archive; what matters is the dictionary
inside. A TensorFlow checkpoint is a set of files sharing a prefix such as
model.ckpt. This page follows Lightning’s
checkpoint_connector.py
(dump_checkpoint) and TensorFlow’s
tensor_bundle.h,
tensor_bundle.cc and tensor_bundle.proto, all read
2026-11-12.
PyTorch Lightning
The pickled object is a dictionary. Lightning always writes the first five keys;
the next ones are left out when the checkpoint is saved with
weights_only.
| Key | Value |
|---|---|
epoch | The training epoch. The code notes it is kept for compatibility and not used for restoring. |
global_step | The global training step, likewise. |
pytorch-lightning_version | The Lightning version that wrote the file. |
state_dict | The model’s state_dict: parameter names mapped to tensors. |
loops | State of fit_loop, validate_loop, test_loop and predict_loop. |
callbacks | Each callback’s state (not with weights_only). |
optimizer_states | A list with each optimiser’s state_dict (not with weights_only). |
lr_schedulers | A list with each learning-rate scheduler’s state_dict (not with weights_only). |
| The precision plugin’s class name | Its state, when it has any (not with weights_only). |
hyper_parameters | The model’s and data module’s saved hyperparameters, as a dictionary (or an OmegaConf container). |
hparams_name, hparams_type | The name the hyperparameters were saved under, and the container type when OmegaConf is used. |
| The data module’s class name | Its state_dict, when it returns one. |
| Anything else | The model’s on_save_checkpoint hook may add its own keys. |
TensorFlow checkpoint bundle
A tensor bundle is a set of immutable files with a common prefix:
ckpt.index
ckpt.data-00000-of-00020
ckpt.data-00001-of-00020
…
ckpt.data-00019-of-00020
- The
.indexfile is a string-to-string immutable table (TensorFlow’stable::Table). Each key is a tensor name and each value a serialisedBundleEntryProto. - The key that is the empty string, always the first in the table, holds a
BundleHeaderProto. - The
.data-NNNNN-of-NNNNNshards hold the raw tensor bytes. The writer can pad each tensor to a set data alignment.
| Message | Field | Meaning |
|---|---|---|
BundleHeaderProto | 1 num_shards | Number of data files. |
2 endianness | 0 little (the default), 1 big. It affects only the tensor bytes, not the protobufs, and a bundle can only be read on a platform of the same byte order. | |
3 version | A VersionDef; the writer sets producer 1 and minimum consumer 0. | |
BundleEntryProto | 1 dtype, 2 shape | The tensor’s data type and shape. |
3 shard_id | Which data file holds the bytes. | |
4 offset | Start of the bytes in that file. | |
5 size | Number of bytes. | |
6 crc32c | CRC-32C of the tensor bytes. | |
7 slices | Present only for a partitioned tensor: then fields 1 and 2 describe the full tensor, fields 3 to 6 are ignored, and each slice has its own entry, keyed by the slice name. |