Skip to content

fix(prepare): harden tokenizer and token_bytes cache loading with sha256 checksums - #616

Open
aniruddhaadak80 wants to merge 1 commit into
karpathy:masterfrom
aniruddhaadak80:fix/issue-41-tokenizer-cache-integrity
Open

fix(prepare): harden tokenizer and token_bytes cache loading with sha256 checksums#616
aniruddhaadak80 wants to merge 1 commit into
karpathy:masterfrom
aniruddhaadak80:fix/issue-41-tokenizer-cache-integrity

Conversation

@aniruddhaadak80

Copy link
Copy Markdown

Resolves #41. Currently, prepare.py loads tokenizer.pkl and token_bytes.pt directly from local cache directories without integrity validation. This change computes SHA256 hashes when writing tokenizer.pkl and token_bytes.pt, saves them to corresponding .sha256 files, and verifies them upon loading. If a mismatch is detected, it flags a warning or automatically falls back to retraining/redownloading, preventing crashes or unsafe deserialization of corrupted/tampered cache files.

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.

Harden cache artifact trust boundary in prepare.py

1 participant