karpathy / build-nanogpt

Video+code lecture on building nanoGPT from scratch
3.61k stars 502 forks source link

Refactor: Replace Class Name with cls in from_pretrained Method- Fix subclassing #66

Open mohsenhariri opened 3 months ago

mohsenhariri commented 3 months ago

The original implementation used the class name directly to instantiate the model, which can cause issues when subclassing. This change replaces the explicit class name with cls, allowing the method to correctly instantiate instances of subclasses.