Skip to content

Checkpoint and Reproducibility

Sudhanshu edited this page Nov 11, 2026 · 1 revision

Checkpoint and Model Restoration

flowchart LR
    subgraph TrainingSession["Training session"]
        Model["TransformerClassifier trainable weights"]
        Meta["Configuration + epoch + best validation score"]
        Frozen["Tokenizer + frozen embedding matrix"]
    end
    Model --> File["best_transformer_static_emb.pt"]
    Meta --> File
    Frozen -.->|"NOT packaged in checkpoint"| File
    File --> Restore["Reconstruct model and load state_dict"]
    External["Reacquire matching tokenizer + embedding weights"] --> Restore
    Restore --> Eval["Classification / test evaluation"]
Loading

Stored checkpoint

Default output: transformer_checkpoints/best_transformer_static_emb.pt, configurable using --output.

The saved dictionary includes model_state, best_validation_accuracy, epoch, d_model, n_heads, n_layers, max_len, num_classes, dropout, use_sdpa, tokenizer_id.

Not in the file

  • The real-data MiniLM tokenizer.
  • The frozen MiniLM token embedding matrix.
  • Raw Yelp reviews or datasets.
  • AdamW optimizer state or a training-resume scheduler state.

A downstream inference/evaluation program must reconstruct the same architecture and supply tokenizer + embedding weights consistent with the checkpoint metadata. The script itself reloads the best checkpoint during the same process, when these dependencies are still available in memory.

Security and publication guidance

Do not commit generated .pt checkpoints by default; they can be large and could contain information from private training data in other projects. Review dataset and model licenses separately before redistribution. The included .gitignore excludes checkpoint files and local environments.

Clone this wiki locally