Friday, February 2, 2024

Run a ChatGPT-like AI Bot on a Raspberry Pi.

 Prepare development environment

To start you need to have the C/C++ compiler, and tools like make and git.
sudo apt update sudo apt install git g++ wget build-essential

Download and compile llama.cpp

git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp make -j


Download a LLM 

You now need to download a language model. Choose one of the models listed below or download your preferred model. Make sure you get the GGUF version (not the GGML variety). These model files are many gigabytes each so make sure you have plenty of free space. If your SD Card does not have enough space, consider utilizing additional storage, such as a USB flash drive.

You can check the free space on the drive which holds your home directory using `df -h ~`

Download a Llama 2 Chat 7B @ Q4_K_S

cd models wget https://huggingface.co/TheBloke/Llama-2-7b-Chat-GGUF/resolve/main/llama-2-7b-chat.Q4_K_S.gguf



Test the LLM

Change directory back to the main llama.cpp directory, where the `main` binary has been built (i.e. `cd ..`)
./main -m models/<MODEL-NAME.gguf> -p "Building a website can be done in 10 simple steps:\nStep 1:" -n 400 -e

For example:

./main -m models/llama-2-7b-chat.Q4_K_S.gguf -p "Building a blog can be done in 10 simple steps:\nStep 1:" -n 400 -e 


 

No comments:

Post a Comment

What is DaemonSet in Kubernetes

 A DaemonSet is a type of controller object that ensures that a specific pod runs on each node in the cluster. DaemonSets are useful for dep...