rabiyulfahim commited on
Commit
247f998
·
verified ·
1 Parent(s): 484d307

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -8
Dockerfile CHANGED
@@ -4,7 +4,7 @@ FROM python:3.10-slim
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies (for PyTorch and git)
8
  RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
9
 
10
  # Copy requirements and install
@@ -14,18 +14,18 @@ RUN pip install --no-cache-dir -r requirements.txt
14
  # Copy application code
15
  COPY . .
16
 
17
- # ✅ Hugging Face cache directory (use /tmp, writable in Spaces)
18
  ENV HF_HOME=/tmp
 
19
 
20
- # Pre-download model into /tmp to avoid cold start
21
  RUN python -c "from transformers import AutoTokenizer, AutoModelForCausalLM; \
22
- model_id='rabiyulfahim/qa_python_gpt2'; \
23
  AutoTokenizer.from_pretrained(model_id, cache_dir='/tmp'); \
24
  AutoModelForCausalLM.from_pretrained(model_id, cache_dir='/tmp')"
25
 
26
-
27
- # Expose the correct port (Hugging Face default is 7860)
28
  EXPOSE 7860
29
 
30
- # Command to run the app
31
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies
8
  RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
9
 
10
  # Copy requirements and install
 
14
  # Copy application code
15
  COPY . .
16
 
17
+ # ✅ Hugging Face cache directory
18
  ENV HF_HOME=/tmp
19
+ ENV TRANSFORMERS_CACHE=/tmp
20
 
21
+ # Pre-download K2-Think model to avoid cold start
22
  RUN python -c "from transformers import AutoTokenizer, AutoModelForCausalLM; \
23
+ model_id='LLM360/K2-Think'; \
24
  AutoTokenizer.from_pretrained(model_id, cache_dir='/tmp'); \
25
  AutoModelForCausalLM.from_pretrained(model_id, cache_dir='/tmp')"
26
 
27
+ # Expose port
 
28
  EXPOSE 7860
29
 
30
+ # Command to run the FastAPI app
31
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]