Earlier quoted context omitted.
Looks like you spoke too soon, I'm clocking 340+ tokens per second with my improved Rust implementation, compared to 106 with the original C. That being said, I didn't share this for any reason other than to share ideas and promote learning. Cheers
540 tok/s on the C version using -ffast-math and -Ofast https://twitter.com/karpathy/status/1683301419716313089?s=20
Llama2.c: Inference llama 2 in one file of pure C
151–160 of 173 posts
Re: Llama2.c: Inference llama 2 in one file of pure C
#152Earlier quoted context omitted.
Would you say that running on bare metal the huggingface.co libraries - as the comment that I replied to suggested - is pretty simple?
It doesn't use the huggingface.co libraries?
tomrod replied to lachlan_gray that the huggingface.co libraries make it pretty simple.
I pointed out to tomrod what is the meaning of the expression “bare metal”.
I don’t understand what’s the point of your reply to me in that context.
Re: Llama2.c: Inference llama 2 in one file of pure C
#153I've found Llama-2 to be unusably "safety filtered" for creative work: https://i.imgur.com/GFY0wSL.png
we need to kick the "ethical AI" people out. Its becoming increasingly clear they are damn annoying. I don't want safety scissors. restrict things running on your own servers, sure but don't give me a model I can't modify and use how i want on my machine.
Re: Llama2.c: Inference llama 2 in one file of pure C
#154I've found Llama-2 to be unusably "safety filtered" for creative work: https://i.imgur.com/GFY0wSL.png
we need to kick the "ethical AI" people out. Its becoming increasingly clear they are damn annoying. I don't want safety scissors. restrict things running on your own servers, sure but don't give me a model I can't modify and use how i want on my machine.
Re: Llama2.c: Inference llama 2 in one file of pure C
#155Earlier quoted context omitted.
so just to understand... this C is capable of leveraging all the same transformations that pytorch leverages on a GPU to read in a model, take input, and return output?
No. The C code can read in a model weight, take input, and return output, but it runs on CPU, not GPU. It also can't run any other models, unlike PyTorch. The model is hardcoded to Llama 2.
Thanks for explaining.
Re: Llama2.c: Inference llama 2 in one file of pure C
#156What is required to actually feed it text and then retrieve the results? So instead of having it produce the story of Lily, write something different?
Re: Llama2.c: Inference llama 2 in one file of pure C
#157Here's a Rust version in case anyone's curious what it would look like. It also clocks 106 tokens/second in release mode. https://github.com/garrisonhess/llama2.c/blob/517a1a3e487f31...
Re: Llama2.c: Inference llama 2 in one file of pure C
#158Earlier quoted context omitted.
As often with Rust, someone transliterates something that already exists just because they can, without providing any benefit at all. Sometimes it even results in fragmenting the community efforts to improve the project.
Can you chill? Stuff like this is super useful. The original c file is educational, so is this. And now by having it two ways, we have a tiny little Rosetta Stone for folks that wanna learn.
Re: Llama2.c: Inference llama 2 in one file of pure C
#159Bravo!
Re: Llama2.c: Inference llama 2 in one file of pure C
#160Here's a Rust version in case anyone's curious what it would look like. It also clocks 106 tokens/second in release mode. https://github.com/garrisonhess/llama2.c/blob/517a1a3e487f31...
Another random (self) plug for a rust version, this uses the candle ML library we've been working on for the last month and can be run in the browser. https://laurentmazare.github.io/candle-llama2/index.html The non-web version has full GPU support but is not at all minimalist :)