Zeyad-Alaa commited on
Commit
cd5cdf3
·
verified ·
1 Parent(s): fb02e0f

Upload 5 files

Browse files
Files changed (5) hide show
  1. .dockerignore +12 -0
  2. .env +1 -0
  3. Dockerfile +44 -0
  4. docker-compose.yml +46 -0
  5. requirements.txt +20 -0
.dockerignore ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.pyd
5
+ .cache/
6
+ .git/
7
+ .vscode/
8
+ hf_cache/
9
+ models/
10
+ qwenmodel/
11
+ *.ipynb
12
+ .env
.env ADDED
@@ -0,0 +1 @@
 
 
1
+ HUGGING_FACE_HUB_TOKEN=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
Dockerfile ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+ ENV PYTHONDONTWRITEBYTECODE=1
5
+ ENV PYTHONUNBUFFERED=1
6
+ ENV HF_HOME=/cache/huggingface
7
+ ENV HF_HUB_CACHE=/cache/huggingface/hub
8
+ ENV TOKENIZERS_PARALLELISM=false
9
+
10
+ RUN apt-get update && apt-get install -y --no-install-recommends \
11
+ python3 \
12
+ python3-pip \
13
+ curl \
14
+ libglib2.0-0 \
15
+ libsm6 \
16
+ libxrender1 \
17
+ libxext6 \
18
+ && apt-get clean \
19
+ && rm -rf /var/lib/apt/lists/*
20
+
21
+ RUN ln -s /usr/bin/python3 /usr/bin/python
22
+
23
+ WORKDIR /app
24
+
25
+ COPY requirements.txt .
26
+
27
+ RUN pip install --no-cache-dir --upgrade pip setuptools wheel
28
+
29
+ RUN pip install --no-cache-dir \
30
+ torch==2.3.1 \
31
+ torchvision==0.18.1 \
32
+ torchaudio==2.3.1 \
33
+ --index-url https://download.pytorch.org/whl/cu121
34
+
35
+ RUN pip install --no-cache-dir -r requirements.txt
36
+
37
+ COPY . .
38
+
39
+ EXPOSE 8000
40
+
41
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=300s --retries=3 \
42
+ CMD curl -f http://localhost:8000/ready || exit 1
43
+
44
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
docker-compose.yml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ ui-ai-service:
3
+
4
+ shm_size: "8gb"
5
+ gpus: all
6
+
7
+ build:
8
+ context: .
9
+ dockerfile: Dockerfile
10
+
11
+ image: ui-ai-service:latest
12
+
13
+ container_name: ui-ai-service
14
+
15
+ ports:
16
+ - "8000:8000"
17
+
18
+ env_file:
19
+ - .env
20
+
21
+ environment:
22
+ BASE_MODEL_ID: Qwen/Qwen2.5-VL-3B-Instruct
23
+ HF_HOME: /cache/huggingface
24
+ HF_HUB_CACHE: /cache/huggingface/hub
25
+ TOKENIZERS_PARALLELISM: "false"
26
+
27
+ volumes:
28
+ - hf_cache:/cache/huggingface
29
+
30
+ restart: unless-stopped
31
+
32
+ healthcheck:
33
+ test: ["CMD", "curl", "-f", "http://localhost:8000/ready"]
34
+ interval: 30s
35
+ timeout: 10s
36
+ start_period: 300s
37
+ retries: 3
38
+
39
+ logging:
40
+ driver: "json-file"
41
+ options:
42
+ max-size: "50m"
43
+ max-file: "5"
44
+
45
+ volumes:
46
+ hf_cache:
requirements.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ numpy<2
2
+
3
+ fastapi==0.111.0
4
+ uvicorn[standard]==0.29.0
5
+
6
+
7
+ transformers==4.51.3
8
+ accelerate==0.34.2
9
+ peft==0.12.0
10
+
11
+ pillow==10.4.0
12
+ qwen-vl-utils==0.0.8
13
+
14
+ sentencepiece
15
+ protobuf
16
+ safetensors
17
+ einops
18
+
19
+ requests
20
+ python-dotenv