Install Llama Coder in VS Code, GitHub Copilot Alternative

Install Llama Coder in VS Code

Learn to Install Llama Coder in VS Code to get real-time code suggestions and generate code from comments functionality.

Undoubtedly, sooner AI is gonna replace coders. The first fully autonomous AI software engineer Devin has already been introduced by Cognition Labs. However, for now, AI is helping coders to do their tasks faster. Like, GitHub Copilot, which provides multi-line suggestions prompted by code and code comments. It is a code completion tool developed by GitHub and OpenAI. GitHub Copilot assists Visual Studio, VS Code, NeoWinvim, and JetBrains IDE users in coding. It is currently trained in all languages that appear in public repositories. With GitHub Copilot and a little bit of coding knowledge, you can build apps and websites faster.

However, GitHub Copilot currently costs around $10 per month or $100 per year. That might be not affordable for young learners. Yes, there are so many GitHub Copilot Alternatives available. But, we are going to discuss Llama Coder in this article.

What is Llama Coder, Is it GitHub Copilot Alternative?

Llama Coder is one of the best Github Copilot replacements for VS Studio Code. It uses Ollama and codellama. Which allows you to run LLM locally on your hardware. It works quite well with Mac M1/M2/M3 models and with RTX 4090. I have tested it in my GTX 1060 6GB, and it works well.

First, you have to install Ollama on your Computer. After that, you have to install the Llama Coder extension in Visual Studio Code. Next, VS Code will prompt you to download the default model. Afterward, you can get the code snippet just by writing a comment.

Install Llama Coder in VS Code

Download and Install Ollama on your Computer.

  1. First, go to the official website of Ollama. And, click on Download.
  1. Click on the “Download for Windows (Preview)” option. Ollama Setup will start downloading, file size is around 225MB.
Download Ollama for Windows

If you’re on Mac, then you will get the “Download for macOS” option.

  1. Do right-click on the “OllamaSetup.exe” setup file and run as administrator.

UAC window will appear, click on Yes.

  1. The Ollama Windows Preview setup screen will appear, click on Install.
Ollama Windows Preview Setup
  1. Ollama will start installing it on your computer.
  1. Once, it gets installed, you will see Ollama is running a notification.
Ollama is running on Computer

You can click on the notification, the CMD window will open, and from it, you can run commands. (optional)

Install Microsoft Visual Studio Code.

If you’re using any other IDE, then you have to install Microsoft Visual Studio Code. Since, the Llama Coder extension is only available for VS Code. VS Code is a source-code editor developed by Microsoft for Windows, Linux, and macOS.

  1. First, download the latest version of Visual Studio Code. And, install it on your Computer.
Download Visual Studio Code
  1. Once, the VSCode setup gets downloaded, Right-Click on it, and then click on “Run as administrator”.
  1. The Microsoft Visual Studio Code setup window will open.
  1. Now, follow all on-screen instructions and install VS Code on your Computer.
Install Microsoft Visual Studio Code on Windows

Install Llama Coder Extension.

  1. Once Visual Studio Code gets installed, open it. From the left pane, click on Extensions.
  1. In Extension Marketplace, now search for “Llama Coder”.
Install Llama Coder Extension on VS Code
  1. Select the extension and click on Install. Once installed, the extension will be enabled globally.
  1. After that, click on Settings Icon, then click on Extension Settings.
Install Llama Coder Extension in VS Code
  1. From extension settings, now you can choose a model. Or, you can keep it to default.

Install Python Extension.

Since I am going to test Llama Coder in a Python Project. So, I am installing Python Extension. Make sure, you have installed the latest version of Python on your Computer.

  1. Again, click on the Extension Icon from the left pane.
  1. Do search for Python and Install the Extension.
Install Python Extension

Create a file

  1. Click on File > New File.
Create New File in VS Code
  1. A new file creation window will open, type and press enter.
Create New Main Python File
  1. VS Code will now ask for a location to save the file.
  1. Select a directory and click on Create File. You can simply choose the documents folder.

Download a Model and Test Llama Coder

  1. Now, type the following code in Llama Coder and press enter.
import os
#Write a program to sum two numbers
Type Comment to Generate Code using Llama Coder
  1. You will immediately get a notification that will ask you to download the model. Click on Yes. (If you don’t see any notification. Then check the bottom right corner of the VS Code. Make sure the Llama coder is loaded properly.
Download Model for Llama Coder
  1. Now, wait for the model to get downloaded.
  1. Once, instead of downloading you see Llama Coder in the bottom right corner of the screen. Do type the code again and press enter.
  1. This time you will see a code suggestion, simply press the tab to accept the code suggestion.
Generate Code using Llama Coder in VS Code

So, that’s how you can install Llama Coder in VS Code. You can also download custom models as well.