Find answers from the community

Updated 2 months ago

I'm trying to run llama index with llama

I'm trying to run llama index with llama cpp by following the installation docs but inside a docker container.

DOCKERFILE
Plain Text
# Use the official Python image for Python 3.11
FROM python:3.11

# Set the working directory in the container
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# ARG FORCE_CMAKE=1

# ARG CMAKE_ARGS="-DLLAMA_CUBLAS=on"


# Install project dependencies

RUN CMAKE_ARGS="-DLLAMA_CUBLAS=on" python -m pip install -r requirements.txt

# Command to run the server
CMD ["python", "./server.py"]


Problem:
For some reason, the env variables in the llama cpp docs do not work as expected in a docker container.

Current behaviour: BLAS= 0 (llm using CPU)


Expected behaviour: BLAS= 1 (llm using GPU)
Attachment
284584374-51d076a9-8c8c-43a2-b907-96ed6958611f.png
L
C
9 comments
Is your GPU even visible inside the docker container?
I ran nvidia smi inside the container and yes it's visible there.
Not entirely sure then -- I've never tried running llama.cpp through docker
ah that sucks, could you recommend any other discord servers where I can get help regarding this?
to anyone who stumbles upon this thread:
I solved this using a cuda image

updated dockerfile:
Plain Text
FROM nvidia/cuda:12.3.0-devel-ubuntu22.04

# Set the working directory in the container
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# Install Python and pip
RUN apt-get update && apt-get install -y python3 python3-pip

# Set environment variable
ENV CMAKE_ARGS="-DLLAMA_CUBLAS=ON"

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
    pip install -r requirements.txt --no-cache-dir

# Command to run the server
CMD ["python3", "./server.py"]
@Logan M tagging you to let you know.
had to ask on stack overflow myself since there was no other question lol.
Add a reply
Sign up and join the conversation on Discord