02.35 · UNIT 10 · Train, evaluate, and serve your transformer · Lesson
Checkpoints, inference, and responsible model reuse
Reliable reuse saves learned tensors plus the configuration that gives them meaning.
PLAIN-LANGUAGE INTRODUCTION
The idea
Reliable reuse saves learned tensors plus the configuration that gives them meaning.
A worked example
A fixed input returns logits
[1.2,−0.4,0.8] before saving. Reloading in evaluation mode should match them.The input
A checkpoint, matching model structure, tokenizer, and fixed test input.
The result
Reproducible logits or documented fine-tuning results.
Why you use it
A reload check catches missing parameters and configuration mismatches.
A limit to remember
A weight file alone does not define preprocessing or label meanings.
Check your understanding
- Logits are raw output scores. This illustration uses
[1.2,−0.4,0.8]for one fixed input. - Save the state dictionary plus model configuration, vocabulary, and special-token IDs.
- Recreate the same architecture. Load the tensors. Set evaluation mode and disable gradient recording.
- Run the fixed input again. Compare all logits within a stated numeric tolerance.
- Common mistake: dropout in training mode can make two correct runs produce different logits.