Skip to main content

AI Chat llama (starting procedure)

Environment: Ubuntu (use Linux only), 32GB RAM, RTX 3050Ti

1.      Download the model this link (https://ai.meta.com/resources/models-and-libraries/llama-downloads/ ). Fill in all details, an email will send to your inbox.

2.      Git clone this project you’re your folder.

`git clone https://github.com/facebookresearch/llama?fbclid=IwAR3DQZH0OySZ3oil5bTNW1lEJcpxBA61ChFQ4bxZhr5z_6V2gCRrbiiyoA8`

3.      cd llama

4.      Run the command: ‘bash download.sh’. After that, you need to enter the URL that receive from the email. Next, you need the enter the following model name you want to download based on the message prompt, e.g., 7B or 7B-chat.

5.      Run command ‘python setup.py install’.

6.      After above all steps done, type command `code .` to view the code.

7.      In Visual studio code, check the example_chat_completion.py code and modify the input.

8.      Run this command and see the result.

torchrun --nproc_per_node 1 example_chat_completion.py --ckpt_dir llama-2-7b-chat/ --tokenizer_path tokenizer.model --max_seq_len 128 --max_batch_size 4’