General VM setup

sudo apt update && sudo apt upgrade -y
sudo apt install -y git curl wget build-essential
sudo apt install -y python3 python3-pip python3-venv

Miniconda installation

wget <https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh>
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
echo 'export PATH="$HOME/miniconda/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
conda tos accept --override-channels --channel <https://repo.anaconda.com/pkgs/main>
conda tos accept --override-channels --channel <https://repo.anaconda.com/pkgs/r>

Miniconda Environment

conda create -n codellama python=3.10 -y
conda init
source ~/.bashrc
conda activate codellama

CUDA & Libraries

pip install torch torchvision torchaudio --index-url <https://download.pytorch.org/whl/cu121>
pip install transformers accelerate bitsandbytes

Hugging face setup

pip install huggingface_hub
huggingface-cli login
# paste token generated from <https://huggingface.co/settings/tokens>

Model download

sudo apt install git-lfs -y
git lfs install
# git clone <https://huggingface.co/codellama/CodeLlama-13b-Instruct-hf>
git clone <https://huggingface.co/Qwen/Qwen2.5-Coder-32B-Instruct>

NVIDIA setup

sudo apt update
sudo apt install -y nvidia-driver-550
sudo reboot

GPU Check

import torch
print(torch.cuda.is_available())        # ✅ True
print(torch.cuda.get_device_name(0))    # ✅ "NVIDIA A100"