meta-llama / llama-models

Utilities intended for use with Llama models.
Other
4.92k stars 843 forks source link

Add example scripts to show how to run the model #108

Closed ashwinb closed 3 months ago

ashwinb commented 3 months ago

Folks really want the llama-models repository to be self-contained. That is, they want to be able to simply run the models without needing other dependencies like llama-toolchain. See https://github.com/meta-llama/llama-models/issues/82 for a discussion.

This PR adapts the example_*_completion.py scripts from the meta-llama/llama3/ repository so it works for llama3.1 models with the updated types.

Note that in order to run these scripts, you need to install additional dependencies not specified in requirements.txt: These are:

zewpo commented 3 months ago

The example is on the right track. Great effort. Thanks.

Still it assumes some prior experience of how these llama models are used. I'd like the example to be a bit more explicit for someone with no experience with llama models. A hello world that will just work by following the instructions. After I get it working, then I can start to break it down and see what is going on inside. I think it only needs a couple small tweaks.

Some explanation, with working example, as to what to use for and

As it is now, it doesn't actually provide explicit example of how to run the downloaded files! How do we actually reference the files that were just downloaded?

models/llama3_1/Meta-Llama-3.1-8B/consolidated.00.pth models/llama3_1/Meta-Llama-3.1-8B/params.json models/llama3_1/Meta-Llama-3.1-8B/tokenizer.model

I'm also curious that the "tokenizer.model" file is also in the api folder, as well as with the model. And was thinking that since the example is based on the files in the api folder, it seems like we might not need to reference a tokenizer model explicitly? (I'm assuming that the needs to refer to this tokenizer.model file.) Is this correct, and/or needed for a simple hello world example?

whatdhack commented 3 months ago

Do not see this PR in main anymore .

ashwinb commented 3 months ago

@whatdhack The content just changed location? It is in models/scripts/ instead of in the llama3_1 sub-folder. The top-level README has also been updated. See https://github.com/meta-llama/llama-models?tab=readme-ov-file#running-the-models