drrobot9 commited on
Commit
852b68d
·
1 Parent(s): 4d564d9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +55 -55
Dockerfile CHANGED
@@ -1,56 +1,56 @@
1
- # Base Image
2
- FROM python:3.10-slim
3
-
4
-
5
- ENV DEBIAN_FRONTEND=noninteractive \
6
- PYTHONUNBUFFERED=1 \
7
- PYTHONDONTWRITEBYTECODE=1
8
-
9
-
10
- WORKDIR /code
11
-
12
- # System Dependencies
13
- RUN apt-get update && apt-get install -y --no-install-recommends \
14
- build-essential \
15
- git \
16
- curl \
17
- libopenblas-dev \
18
- libomp-dev \
19
- && rm -rf /var/lib/apt/lists/*
20
-
21
-
22
- COPY requirements.txt .
23
- RUN pip install --no-cache-dir -r requirements.txt
24
-
25
- # Hugging Face + model tools
26
- RUN pip install --no-cache-dir huggingface-hub sentencepiece accelerate fasttext
27
-
28
- # Hugging Face cache environment
29
- ENV HF_HOME=/models/huggingface \
30
- TRANSFORMERS_CACHE=/models/huggingface \
31
- HUGGINGFACE_HUB_CACHE=/models/huggingface \
32
- HF_HUB_CACHE=/models/huggingface
33
-
34
- # Created cache dir and set permissions
35
- RUN mkdir -p /models/huggingface && chmod -R 777 /models/huggingface
36
-
37
- # Pre-download models at build time
38
- RUN python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='Qwen/Qwen3-4B-Instruct-2507')" \
39
- && python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2')" \
40
- && python -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='facebook/fasttext-language-identification', filename='model.bin')" \
41
- && python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='drrobot9/nllb-ig-yo-ha-finetuned')" \
42
- && find /models/huggingface -name '*.lock' -delete
43
-
44
- # Preload tokenizers (avoid runtime delays)
45
- RUN python -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('Qwen/Qwen3-4B-Instruct-2507', use_fast=True)" \
46
- && python -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2', use_fast=True)" \
47
- && python -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('drrobot9/nllb-ig-yo-ha-finetuned', use_fast=True)"
48
-
49
- # Copy project files
50
- COPY . .
51
-
52
- # Expose FastAPI port
53
- EXPOSE 7860
54
-
55
- # Run FastAPI app with uvicorn (1 workers for concurrency)
56
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
1
+ # Base Image
2
+ FROM python:3.10-slim
3
+
4
+
5
+ ENV DEBIAN_FRONTEND=noninteractive \
6
+ PYTHONUNBUFFERED=1 \
7
+ PYTHONDONTWRITEBYTECODE=1
8
+
9
+
10
+ WORKDIR /code
11
+
12
+ # System Dependencies
13
+ RUN apt-get update && apt-get install -y --no-install-recommends \
14
+ build-essential \
15
+ git \
16
+ curl \
17
+ libopenblas-dev \
18
+ libomp-dev \
19
+ && rm -rf /var/lib/apt/lists/*
20
+
21
+
22
+ COPY requirements.txt .
23
+ RUN pip install --no-cache-dir -r requirements.txt
24
+
25
+ # Hugging Face + model tools
26
+ RUN pip install --no-cache-dir huggingface-hub sentencepiece accelerate fasttext
27
+
28
+ # Hugging Face cache environment
29
+ ENV HF_HOME=/models/huggingface \
30
+ TRANSFORMERS_CACHE=/models/huggingface \
31
+ HUGGINGFACE_HUB_CACHE=/models/huggingface \
32
+ HF_HUB_CACHE=/models/huggingface
33
+
34
+ # Created cache dir and set permissions
35
+ RUN mkdir -p /models/huggingface && chmod -R 777 /models/huggingface
36
+
37
+ # Pre-download models at build time
38
+ RUN python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='Qwen/Qwen3-4B-Instruct-2507')" \
39
+ && python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2')" \
40
+ && python -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='facebook/fasttext-language-identification', filename='model.bin')" \
41
+ && python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='facebook/nllb-200-distilled-600M')" \
42
+ && find /models/huggingface -name '*.lock' -delete
43
+
44
+ # Preload tokenizers (avoid runtime delays)
45
+ RUN python -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('Qwen/Qwen3-4B-Instruct-2507', use_fast=True)" \
46
+ && python -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2', use_fast=True)" \
47
+ && python -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('facebook/nllb-200-distilled-600M', use_fast=True)"
48
+
49
+ # Copy project files
50
+ COPY . .
51
+
52
+ # Expose FastAPI port
53
+ EXPOSE 7860
54
+
55
+ # Run FastAPI app with uvicorn (1 workers for concurrency)
56
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]