lolout1 commited on
Commit
f9277d5
·
1 Parent(s): 3387ba6

updating dockerfile and dependencies for optimal hf deployment

Browse files
Files changed (2) hide show
  1. Dockerfile +29 -7
  2. requirements.txt +46 -10
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM python:3.10
2
 
3
  # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
@@ -14,6 +14,7 @@ RUN apt-get update && apt-get install -y \
14
  libgl1-mesa-glx \
15
  libgtk2.0-dev \
16
  wget \
 
17
  unzip \
18
  ffmpeg \
19
  libopencv-dev \
@@ -23,13 +24,27 @@ RUN apt-get update && apt-get install -y \
23
  # Create user
24
  RUN useradd -m -u 1000 user
25
 
26
- # Install PyTorch with ALL dependencies
27
- RUN pip install torch==2.0.1+cpu torchvision==0.15.2+cpu torchaudio==2.0.2+cpu \
28
- --index-url https://download.pytorch.org/whl/cpu
29
 
30
- # Install detectron2 using pre-built wheel (much more reliable)
 
 
 
 
 
 
31
  RUN pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch2.0/index.html
32
 
 
 
 
 
 
 
 
 
 
33
  # Switch to user
34
  USER user
35
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
@@ -40,12 +55,19 @@ ENV CUDA_VISIBLE_DEVICES=""
40
  ENV FORCE_CUDA="0"
41
  ENV TORCH_CUDA_ARCH_LIST=""
42
 
43
- # Copy and install requirements
44
  COPY --chown=user:user requirements.txt .
45
  RUN pip install --user --no-cache-dir -r requirements.txt
46
 
47
  # Copy app files
48
  COPY --chown=user:user . .
49
 
 
 
 
 
 
 
 
50
  EXPOSE 7860
51
- CMD ["python", "app.py"]
 
1
+ FROM python:3.10-slim
2
 
3
  # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
 
14
  libgl1-mesa-glx \
15
  libgtk2.0-dev \
16
  wget \
17
+ curl \
18
  unzip \
19
  ffmpeg \
20
  libopencv-dev \
 
24
  # Create user
25
  RUN useradd -m -u 1000 user
26
 
27
+ # Install Python dependencies in correct order
28
+ RUN pip install --upgrade pip setuptools wheel
 
29
 
30
+ # Install sympy FIRST (required by torch)
31
+ RUN pip install sympy
32
+
33
+ # Install PyTorch CPU version
34
+ RUN pip install torch==2.0.1+cpu torchvision==0.15.2+cpu --index-url https://download.pytorch.org/whl/cpu
35
+
36
+ # Install detectron2 from pre-built wheel (more reliable)
37
  RUN pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch2.0/index.html
38
 
39
+ # Install other dependencies
40
+ RUN pip install \
41
+ numpy>=1.23.0,<2.0.0 \
42
+ opencv-python \
43
+ scipy \
44
+ scikit-learn \
45
+ gradio \
46
+ huggingface_hub
47
+
48
  # Switch to user
49
  USER user
50
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
 
55
  ENV FORCE_CUDA="0"
56
  ENV TORCH_CUDA_ARCH_LIST=""
57
 
58
+ # Copy requirements and install remaining dependencies
59
  COPY --chown=user:user requirements.txt .
60
  RUN pip install --user --no-cache-dir -r requirements.txt
61
 
62
  # Copy app files
63
  COPY --chown=user:user . .
64
 
65
+ # Clone and setup OneFormer if needed
66
+ RUN if [ ! -d "oneformer" ]; then \
67
+ git clone https://github.com/SHI-Labs/OneFormer.git oneformer && \
68
+ cd oneformer && \
69
+ pip install --user -e . ; \
70
+ fi
71
+
72
  EXPOSE 7860
73
+ CMD ["python", "gradio_test.py"]
requirements.txt CHANGED
@@ -1,19 +1,62 @@
1
- # Core dependencies (NO torch, NO detectron2, NO natten)
2
  numpy>=1.23.0,<2.0.0
3
  Pillow>=8.3.2
4
  opencv-python
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  git+https://github.com/cocodataset/panopticapi.git
6
  git+https://github.com/mcordts/cityscapesScripts.git
 
 
7
  imutils
8
  cython
9
  setuptools==59.5.0
 
 
 
 
 
 
 
 
 
 
 
 
10
  scipy
 
 
11
  shapely
12
  h5py
13
- submitit
14
- scikit-image
15
  timm==0.4.12
16
  einops
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  icecream
18
  wandb
19
  ftfy
@@ -21,11 +64,4 @@ regex
21
  inflect
22
  diffdist
23
  gdown
24
- huggingface_hub
25
- pytorch_lightning==2.0.0
26
- tqdm
27
- gradio
28
  wget
29
-
30
- # NATTEN - install separately if needed
31
- # natten==0.14.6+torch200cpu -f https://shi-labs.com/natten/wheels/cpu/torch2.0.0/index.html
 
1
+ # Core dependencies (torch and detectron2 installed in Dockerfile)
2
  numpy>=1.23.0,<2.0.0
3
  Pillow>=8.3.2
4
  opencv-python
5
+ scipy
6
+ scikit-learn
7
+ scikit-image
8
+ shapely
9
+ h5py
10
+ timm==0.4.12
11
+ einops
12
+ tqdm
13
+ gradio>=4.0.0
14
+ huggingface_hub
15
+ matplotlib
16
+ pycocotools
17
+
18
+ # Git dependencies
19
  git+https://github.com/cocodataset/panopticapi.git
20
  git+https://github.com/mcordts/cityscapesScripts.git
21
+
22
+ # Additional utilities
23
  imutils
24
  cython
25
  setuptools==59.5.0
26
+ submitit
27
+ icecream
28
+ wandb
29
+ ftfy
30
+ regex
31
+ inflect
32
+ diffdist
33
+ gdown
34
+ wget# Core dependencies (torch and detectron2 installed in Dockerfile)
35
+ numpy>=1.23.0,<2.0.0
36
+ Pillow>=8.3.2
37
+ opencv-python
38
  scipy
39
+ scikit-learn
40
+ scikit-image
41
  shapely
42
  h5py
 
 
43
  timm==0.4.12
44
  einops
45
+ tqdm
46
+ gradio>=4.0.0
47
+ huggingface_hub
48
+ matplotlib
49
+ pycocotools
50
+
51
+ # Git dependencies
52
+ git+https://github.com/cocodataset/panopticapi.git
53
+ git+https://github.com/mcordts/cityscapesScripts.git
54
+
55
+ # Additional utilities
56
+ imutils
57
+ cython
58
+ setuptools==59.5.0
59
+ submitit
60
  icecream
61
  wandb
62
  ftfy
 
64
  inflect
65
  diffdist
66
  gdown
 
 
 
 
67
  wget