Inference for Llama2-like Transformer models in one TypeScript file
Heavily based on the Andrej Karpathy's llama2.c.
Mostly of educational value (understand something by implementing it yourself! porting in this case but still :P)
Includes the TinyStories 15M model.
node (via the bundled t348):
node --experimental-loader=./t348.mjs llama2.ts stories15M.bin -s 1 -t 0 -i "Once upon a time"
bun:
bun llama2.ts stories15M.bin -i "Once upon a time"
Larger TinyStories models:
wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories42M.bin wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories110M.bin
Arguments:
-i <string>
- initial prompt-t <float>
- temperature (0..1, 0 = deterministic argmax)-s <int>
- random seed-n <int>
- number of tokens to generate (0..256, default 256)-p <float>
- p value for nucleus sampling, default 0.9UPD: see also llama2.js by @epicure for a browser version. Glad I missed it before starting this project, otherwise I'd probably never start it :D
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4