Christopher Zenzel

Contents

Table of Contents

Share

Building Llama for Microsoft Windows Subsystem for Linux (WSL 2)

In this blog post you will learn how to build LLaMA, Llama.cpp for Microsoft Windows Subsystem for Linux 2 (also known as WSL 2).

What is LLaMA?

LLaMA (Large Language Model Meta AI) is a collection of powerful foundation language models developed by Meta AI (formerly Facebook AI Research). These models are a type of generative AI, capable of producing human-quality text, translating languages, writing different kinds of creative content, and answering your questions in an informative way. LLaMA comes in several sizes, offering researchers flexibility based on their needs. Smaller models (like the 7B parameter model) are ideal for researchers with limited computational resources, while larger models (like the 65B parameter model) offer even greater capabilities.

Understanding LLaMA requires grasping concepts like large language models (LLMs). LLMs are neural networks trained on massive amounts of text data, giving them impressive language understanding and generation abilities. Generative AI, like LLaMA, refers to AI models that can create new content such as text, images, or music. Foundation models are large, versatile AI models trained on broad datasets, and they can be adapted to many tasks through fine-tuning.

LLaMA is significant for several reasons. It has shown impressive results on various language tasks, sometimes even outperforming much larger models. By releasing smaller LLaMA models, Meta promotes more accessible research in large language models, enabling a wider range of researchers to work in this field. Additionally, Meta focuses on responsible AI principles with LLaMA, aiming to reduce potential harms like biases and the generation of misinformation.

Installing the Windows Subsystem for Linux

From your Start Menu search for and open Turn Windows Features On or Off. Inside the dialog select Windows Subsystem for Linux. After the feature has installed allow the machine to restart accordingly.

Installing Ubuntu

To install Ubuntu for the Windows Subsystem for Linux, also known as WSL 2, please open the Terminal app on Windows 11 of your choice and enter the following command:

wsl --install
ubuntu

When the Ubuntu installer completes you will be prompted to provide a username and password as part of your Ubuntu installation. It does not have to be the same username and password you use to log into Windows with.

Installing the Dependencies

To prepare to install LLaMA.cpp on your Windows Subsystem for Linux Ubuntu instance please install the dependencies by issuing these following commands in command line:

sudo -s
apt-get -y update
apt-get -y dist-upgrade
apt-get -y install git build-essential ccache
exit

Cloning the Repository

To install the latest version of LLaMA.cpp you will need to start by cloning the repository and building the software within it. To clone the repository containing LLaMA.cpp you will need to issue the following commands:

git clone https://github.com/ggerganov/llama.cpp.git

Building the Repository

To build LLaMA.cpp to run under your Windows Subsystem for Linux (WSL 2) environment it is as simple as issuing one single build command inside the repository’s directory:

make -j4

Conclusion

After the build completes successfully you should have access not only to the LLaMA.cpp library, but also access to its built in applications such as server.