CoolFace
Apppublic

1littlecoder/llama-cpp-python-cuda-gradio

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
Dockerfile45 linesDownload Raw Back to root
1ARG CUDA_IMAGE="12.1.1-devel-ubuntu22.04"2FROM nvidia/cuda:${CUDA_IMAGE}3 4# We need to set the host to 0.0.0.0 to allow outside access5ENV HOST 0.0.0.06 7RUN apt-get update && apt-get upgrade -y \8    && apt-get install -y git build-essential \9    python3 python3-pip gcc wget \10    ocl-icd-opencl-dev opencl-headers clinfo \11    libclblast-dev libopenblas-dev \12    && mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd13 14COPY . .15 16# setting build related env vars17ENV CUDA_DOCKER_ARCH=all18ENV LLAMA_CUBLAS=119 20# Install depencencies21RUN python3 -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi uvicorn sse-starlette pydantic-settings gradio huggingface_hub hf_transfer22 23# Install llama-cpp-python (build with cuda)24RUN CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 pip install llama-cpp-python25 26RUN useradd -m -u 1000 user27# Switch to the "user" user28USER user29# Set home to the user's home directory30ENV HOME=/home/user \31	PATH=/home/user/.local/bin:$PATH \32    PYTHONPATH=$HOME/app \33	PYTHONUNBUFFERED=1 \34	GRADIO_ALLOW_FLAGGING=never \35	GRADIO_NUM_PORTS=1 \36	GRADIO_SERVER_NAME=0.0.0.0 \37	GRADIO_THEME=huggingface \38	SYSTEM=spaces39 40WORKDIR $HOME/app41 42# Copy the current directory contents into the container at $HOME/app setting the owner to the user43COPY --chown=user . $HOME/app44 45CMD ["python3", "app.py"]