karpathy/llama2.c ? reverse-engineered prompt

Reverse engineered prompt

Hey, I want to build a small project for running Llama 2 language models. The main idea is to make it super simple and educational. The core feature should be a single, clean C file that can run the model inference without any weird dependencies. I want to be able to compile it easily from the command line on both Mac/Linux and Windows.

To run it, I'd just point it at a model file, and it should start streaming generated text. It should also have basic command-line options to let me provide a starting prompt, control the temperature for creativity, and set the number of tokens to generate.

Besides the C inference runner, I'll also need a way to prepare the models. Could you create the Python scripts for that? I need one script to train a Llama 2-style model from scratch using PyTorch, and another essential script to convert the official Meta Llama 2 models into the simple binary format the C program needs.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab