karpathy / ng-video-lecture

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using the variable "model" after declaring variable "m"

klivin opened this issue · comments

When you call m = model.to(device), it returns a model that shares the same parameters with the original model but is located on the specified device.

So, in your training loop and anywhere else you use the model after this point, you should use m, not model.

https://github.com/karpathy/ng-video-lecture/blob/52201428ed7b46804849dea0b3ccf0de9df1a5c3/gpt.py#L217C2-L217C2

duplicate of #18