shawwn / llama-dl

High-speed download of LLaMA, Facebook's 65B parameter GPT model
GNU General Public License v3.0
4.17k stars 419 forks source link

Inference on the model #1

Open ajaysurya1221 opened 1 year ago

ajaysurya1221 commented 1 year ago

Hi, could someone shed some light on how this model can be loaded and used for inference? I know this is early and everybody might be a little vague on this but still, only for educational purposes.

shawwn commented 1 year ago

Hiya. Yes, right this way: https://twitter.com/rowancrowe/status/1632676722612269057

Basically, clone https://github.com/shawwn/llama and use that for inferencing instead.

Note that it's using FP16 weights, not int8, so the memory requirements are 2x of the int8 quantized model. But personally I'm skeptical that the model can be quantized to int8 without harming its performance, and I don't need it anyway. Maybe I'll make it an option, but until then, you might want to try https://github.com/tloen/llama-int8 instead. (Note that you'll probably need to merge my improved sampler if you're seeing repetitive, low-quality outputs.)

Also note that the repo is set up to use a context window of 2048, which will probably run out of memory on most video cards. So change "2048" to "512" in model.py if needed. (I'm not sure why this causes an OOM, since the default in example.py is 512, but I have no way to reproduce the bug.

Have fun!

johndpope commented 1 year ago

Hey Shawn, not relevant - but would be cool to wire up this somehow https://github.com/patrikzudel/PatrikZeros-ChatGPT-API-UI

randaller commented 1 year ago

Run it on home desktop PC: https://github.com/randaller/llama-chat

jorahn commented 1 year ago

Note that it's using FP16 weights, not int8, so the memory requirements are 2x of the int8 quantized model. But personally I'm skeptical that the model can be quantized to int8 without harming its performance, and I don't need it anyway. Maybe I'll make it an option, but until then, you might want to try https://github.com/tloen/llama-int8 instead. (Note that you'll probably need to merge my improved sampler if you're seeing repetitive, low-quality outputs.)

this is implemented here: https://github.com/jorahn/llama-int8

Straafe commented 1 year ago

@jorahn Nice, 13B working on my 3090

randaller commented 1 year ago

Hi @shawwn, I've implemented your repetion_penalty and top_k sampler in my repo (https://github.com/randaller/llama-chat) and it works great, so I just would like to say Thank you very much!!!

G2G2G2G commented 1 year ago

https://github.com/ggerganov/llama.cpp/issues/23

https://github.com/ggerganov/llama.cpp/pull/20

contributing to this project with chat would enable people to run it on basically any web server (assuming they had enough RAM) 7B only uses ~4gb