Running advanced AI models like Meta’s LLaMA on a MacBook might seem ambitious specifically when you have M1 with 8 GB of RAM, But with the right steps, you can start building AI apps locally on your Mac easily. Thanks to Apple’s processor architecture and efficient libraries like Llama.cpp, you can unlock the power of large language models right from your lightweight laptop.
Let's get you started with the MacBook Air M1 for running these models efficiently.
Step 1:
Download the entire model from Meta's official site by providing your information & details for usage.
Install the necessary packages as mentioned in the readme file.
Run the below command to run the model
torchrun \
--nproc_per_node=$NGPUS \
llama_models/scripts/example_chat_completion.py $CHECKPOINT_DIR \
--model_parallel_size $NGPUS
Definitely, this is not going to work ☹️. To solve this issue we will be following two methods below
first, we will be using llama.cpp which provides lightweight C++ implementation for running models on various hardware.
We will use quantization to reduce the model size so that we will be able to run it easily.
Step 1 (This one will work):
Install llama.cpp using brew.
brew install llama.cpp
Step 2:
Now let's quantize the llama model. To perform this we have a very good space on HuggingFace called GGUF-My-Repo. Follow the below link to go to space.
SOCIAL SHARE CARD GENERATOR