Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misplaced parenthesis #456

Open
BuissonFlorent opened this issue Dec 22, 2024 · 1 comment
Open

Misplaced parenthesis #456

BuissonFlorent opened this issue Dec 22, 2024 · 1 comment

Comments

@BuissonFlorent
Copy link

https://github.com/rasbt/LLMs-from-scratch/blob/bb31de89993441224e9005926dedad95395bb058/ch05/01_main-chapter-code/gpt_train.py#L242C4-L242C70

I believe the last line in the script should read
model.load_state_dict(torch.load("model.pth", weights_only=True))
With weights_only as a parameter of torch.load(), not model.load_state_dict()

@rasbt
Copy link
Owner

rasbt commented Dec 22, 2024

Thanks for pointing that out. I added the weights_only=True recently everywhere so it doesn't raise an unnecessary PyTorch warning and must have misplaced it in this particular case. It should also not be necessary anymore since I think in newer PyTorch versions weights_only=True is not the default. I will fix that in the coming days. Thanks for reporting!

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

No branches or pull requests

2 participants