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.
- First, go to the official website of Ollama. And, click on Download.
- Click on the “Download for Windows (Preview)” option. Ollama Setup will start downloading, file size is around 225MB.
If you’re on Mac, then you will get the “Download for macOS” option.
- Do right-click on the “OllamaSetup.exe” setup file and run as administrator.
UAC window will appear, click on Yes.
- The Ollama Windows Preview setup screen will appear, click on Install.
- Ollama will start installing it on your computer.
- Once, it gets installed, you will see Ollama is running a notification.
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.
- First, download the latest version of Visual Studio Code. And, install it on your Computer.
- Once, the VSCode setup gets downloaded, Right-Click on it, and then click on “Run as administrator”.
- The Microsoft Visual Studio Code setup window will open.
- Now, follow all on-screen instructions and install VS Code on your Computer.
Install Llama Coder Extension.
- Once Visual Studio Code gets installed, open it. From the left pane, click on Extensions.
- In Extension Marketplace, now search for “Llama Coder”.
- Select the extension and click on Install. Once installed, the extension will be enabled globally.
- After that, click on Settings Icon, then click on Extension Settings.
- 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.
- Again, click on the Extension Icon from the left pane.
- Do search for Python and Install the Extension.
Create a main.py
file
- Click on File > New File.
- A new file creation window will open, type
main.py
and press enter.
- VS Code will now ask for a location to save the file.
- Select a directory and click on Create File. You can simply choose the documents folder.
Download a Model and Test Llama Coder
- Now, type the following code in Llama Coder and press enter.
import os
#Write a program to sum two numbers
- 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.
- Now, wait for the model to get downloaded.
- Once, instead of downloading you see Llama Coder in the bottom right corner of the screen. Do type the code again and press enter.
- This time you will see a code suggestion, simply press the tab to accept the code suggestion.
So, that’s how you can install Llama Coder in VS Code. You can also download custom models as well.