Aug 4, 2023
Guide to running llama 2 locally
This article describes three open-source platform for running Llama 2 on your personal devices.
You don't necessarily need to be online to run Llama 2, you can do this locally on your M1/M2 Mac, Windows, Linux, or even your mobile phone. Here's an illustration of using a local version of Llama 2 to design a website about why llamas are cool:
Several techniques are now available for local operation a few days after Llama 2's release. This post details three open-source tools to facilitate running Llama 2 on your personal devices:
Llama.cpp (Mac/Windows/Linux)
Ollama (Mac)
MLC LLM (iOS/Android)
Llama.cpp (Mac/Windows/Linux)
Llama.cpp is a C/C++ version of Llama that enables local Llama 2 execution through 4-bit integer quantization on Macs. It also supports Linux and Windows.
Use this one-liner for installation on your M1/M2 Mac:
Here’s a breakdown of what the one-liner does:
This is the one-liner for your Intel Mac or Linux machine (similar to the above, but without the LLAMA_METAL=1
flag):
This is a one-liner for running on Windows through WSL:
Ollama (Mac)
Ollama is an open-source macOS app (for Apple Silicon) enabling you to run, create, and share large language models with a command-line interface. It already supports Llama 2.
To use the Ollama CLI, download the macOS app at ollama.ai/download. Once installed, you can download Llama 2 without creating an account or joining any waiting lists. Run this in your terminal:
You can then run the model and chat with it:
Note: Ollama recommends having at least 8 GB of RAM to run the 3B models, 16 GB for the 7B models, and 32 GB for the 13B models.
MLC LLM (iOS/Android)
MLC LLM is an open-source initiative that allows running language models locally on various devices and platforms, including iOS and Android.
For iPhone users, there’s an MLC chat app on the App Store. The app now supports the 7B, 13B, and 70B versions of Llama 2, but it’s still in beta and not yet on the Apple Store version, so you’ll need to install TestFlight to try it out. Check out the instructions for installing the beta version here.
Next steps
Follow us on Twitter for the latest updates from the Llama world.
Install the WritingMate.ai chrome extension to use LLama2 in your browser.