blue and black helmet on blue and white textile

Local AI copilot on VSCode

A few people have asked me about my local AI environment, so I thought I’d document it here. Setup subject to change.

Ollama with AMD Radeon GPU (rocm) on docker

I like to run services on docker with compose files. Here’s my compose.yaml for ollama-rocm that provides the AI backend for VSCode and other applications:

version: '3'

    image: ollama/ollama:0.1.27-rocm
    container_name: ollama
    restart: unless-stopped
      - ${HOME}/.ollama:/root/.ollama
      - video
    # AMD
      - /dev/kfd
      - /dev/dri
    # NVIDIA
#    devices:
#      - /dev/nvidia0
#    environment:
      - 11434:11434
      - SYS_PTRACE
      - seccomp:unconfined
    ipc: host

A local ollama installation can communicate with the running docker container. I’ve left the service port open to my local area network, but it can be bound to localhost for added security.

VSCodium extension for local AI: Continue

There are many extensions for local AI. I tried out a few and settled on Continue. The extension is available for VSCode (or VSCodium) and JetBrains.

Continue allows you to generate or refactor your code based on your input, allowing you to accept of cancel changes from a line-by-line diff. You can also ask questions from the AI, and refer any files or code selections in your discussion. More information available on their website,

Continue layout on VSCodium

Continue allows one to run multiple language models simultaneously. I’ve set it up to use ollama by default, with a small model for autocomplete and a larger model for discussions, code refactoring and iteration. I also have GPT-4 available through OpenAI API, if I want to pay for some extra power.

The different models are available in the drop-down menu of Continue, so it’s quick to switch.

AI Models

My current choice is to run CodeLlama 34B as the main AI, along with stable-code 3B for autocompletion. Here’s the relevant config for Continue:

Continue config.json
  "tabAutocompleteModel": {
    "title": "Tab Autocomplete stable-code-3b",
    "provider": "ollama",
    "model": "stable-code",
    "apiBase": ""
  "models": [
      "title": "CodeLlama 34B",
      "provider": "ollama",
      "model": "codellama:34b",
      "apiBase": ""
      "title": "stable-code 7B",
      "provider": "ollama",
      "model": "stable-code",
      "apiBase": ""
      "title": "OpenAI GPT-4-turbo",
      "provider": "openai",
      "apiKey": "sk-XXXX",
      "model": "gpt-4-turbo-preview"
      "title": "OpenAI GPT-4 (full)",
      "provider": "openai",
      "apiKey": "sk-XXXX",
      "model": "gpt-4"

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.