Spaces:
Build error
Build error
Create Dockerfile
Browse files- Dockerfile +29 -0
Dockerfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a lightweight base image with Python
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Install wget to download the model
|
| 5 |
+
RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*
|
| 6 |
+
|
| 7 |
+
# Set working directory
|
| 8 |
+
WORKDIR /app
|
| 9 |
+
|
| 10 |
+
# Install llama-cpp-python with pre-built CPU wheels
|
| 11 |
+
RUN pip install --no-cache-dir \
|
| 12 |
+
"llama-cpp-python[server] @ https://github.com/abetlen/llama-cpp-python/releases/download/v0.2.90/llama_cpp_python-0.2.90-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
|
| 13 |
+
|
| 14 |
+
# Download the Qwen 2.5 Coder GGUF model
|
| 15 |
+
RUN wget https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/main/qwen2.5-coder-7b-instruct-q4_k_m.gguf
|
| 16 |
+
|
| 17 |
+
# Expose the port HF Spaces expects (7860)
|
| 18 |
+
EXPOSE 7860
|
| 19 |
+
|
| 20 |
+
# Run the server
|
| 21 |
+
# --n_threads 2 (HF Free tier has 2 vCPUs)
|
| 22 |
+
# --host 0.0.0.0 --port 7860 (Required for HF)
|
| 23 |
+
CMD ["python3", "-m", "llama_cpp.server", \
|
| 24 |
+
"--model", "qwen2.5-coder-7b-instruct-q4_k_m.gguf", \
|
| 25 |
+
"--host", "0.0.0.0", \
|
| 26 |
+
"--port", "7860", \
|
| 27 |
+
"--n_threads", "2", \
|
| 28 |
+
"--n_gpu_layers", "0", \
|
| 29 |
+
"--n_ctx", "4096"]
|