Skip to content

Refactor: Add Type Hints to Model and Trainer - #152

Open
blosny wants to merge 3 commits into
karpathy:masterfrom
blosny:master
Open

Refactor: Add Type Hints to Model and Trainer#152
blosny wants to merge 3 commits into
karpathy:masterfrom
blosny:master

Conversation

@blosny

@blosny blosny commented Dec 10, 2025

Copy link
Copy Markdown

This PR adds type hints to mingpt/model.py and mingpt/trainer.py to improve code clarity and developer experience.

Changes:

  • Added torch.Tensor, int, Optional, etc. annotations to critical methods like forward and generate in the GPT class.
  • Added type annotations for Trainer class properties and methods (e.g., callback: Callable).
  • The logic remains unchanged; this is purely a readability and IDE support improvement.

@blosny

blosny commented Dec 10, 2025

Copy link
Copy Markdown
Author

Besho777, thank you for your approval The PR is ready to be merged. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants