AIencoder commited on
Commit
ff38038
·
verified ·
1 Parent(s): 2020da6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -18
Dockerfile CHANGED
@@ -1,24 +1,35 @@
1
- # Start with the official full image
2
  FROM ghcr.io/ggml-org/llama.cpp:full
3
-
4
- # Set up the working directory
5
  WORKDIR /app
6
 
7
- # 1. Install Python and Pip (The base image is often minimal Ubuntu)
8
- RUN apt-get update && \
9
- apt-get install -y python3 python3-pip git && \
10
- rm -rf /var/lib/apt/lists/*
11
-
12
- # 2. Copy your requirements and install Python libraries
13
- COPY requirements.txt .
14
- RUN pip3 install --no-cache-dir -r requirements.txt
15
 
16
- # 3. Copy your application code
17
- COPY . .
 
 
 
 
 
 
18
 
19
- # 4. Create a folder for models to live in
20
- RUN mkdir -p /app/models
 
 
 
 
21
 
22
- # 5. IMPORTANT: Override the base image's entrypoint.
23
- # The base image defaults to running 'llama-server', but we want to run 'app.py'
24
- ENTRYPOINT ["python3", "app.py"]
 
 
 
 
 
 
 
 
 
 
 
1
  FROM ghcr.io/ggml-org/llama.cpp:full
 
 
2
  WORKDIR /app
3
 
4
+ # Install Python dependencies for downloading models
5
+ RUN apt update && apt install -y python3-pip
6
+ RUN pip install -U huggingface_hub
 
 
 
 
 
7
 
8
+ # --- MODEL DOWNLOAD SECTION ---
9
+ # 1. Download Qwen 2.5 Coder 14B (Q4_K_M)
10
+ # We rename it to 'model.gguf' to make the CMD section easier to manage.
11
+ RUN python3 -c 'from huggingface_hub import hf_hub_download; \
12
+ repo="Qwen/Qwen2.5-Coder-14B-Instruct-GGUF"; \
13
+ filename="qwen2.5-coder-14b-instruct-q4_k_m.gguf"; \
14
+ hf_hub_download(repo_id=repo, filename=filename, local_dir="/app")' && \
15
+ mv /app/qwen2.5-coder-14b-instruct-q4_k_m.gguf /app/model.gguf
16
 
17
+ # --- OPTIONAL VISION MODEL (Comment out the section above and uncomment this to switch) ---
18
+ # RUN python3 -c 'from huggingface_hub import hf_hub_download; \
19
+ # repo="Qwen/Qwen2.5-VL-7B-Instruct-GGUF"; \
20
+ # filename="qwen2.5-vl-7b-instruct-q4_k_m.gguf"; \
21
+ # hf_hub_download(repo_id=repo, filename=filename, local_dir="/app")' && \
22
+ # mv /app/qwen2.5-vl-7b-instruct-q4_k_m.gguf /app/model.gguf
23
 
24
+ # --- SERVER STARTUP ---
25
+ # We use "--n-gpu-layers 0" for CPU Spaces.
26
+ # We use "-c 8192" because 14B takes a lot of RAM; 32k context might crash the space.
27
+ CMD ["--server", \
28
+ "-m", "/app/model.gguf", \
29
+ "--host", "0.0.0.0", \
30
+ "--port", "7860", \
31
+ "-t", "4", \
32
+ "--cache-type-k", "q8_0", \
33
+ "--cache-type-v", "iq4_nl", \
34
+ "-c", "8192", \
35
+ "--n-gpu-layers", "0"]