This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Example of encoding Functor/Applicative/Monad from cats with Dotty 0.15 features. | |
| * Derived in part from Cats -- see https://github.com/typelevel/cats/blob/master/COPYING for full license & copyright. | |
| */ | |
| package structures | |
| import scala.annotation._ | |
| trait Functor[F[_]] { | |
| def (fa: F[A]) map[A, B](f: A => B): F[B] | |
| def (fa: F[A]) as[A, B](b: B): F[B] = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| The most atomic way to train and run inference for a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
OlderNewer