lolout1 commited on
Commit
18d079d
·
1 Parent(s): f1b1f2e

dockerfile changes for natten

Browse files
Files changed (1) hide show
  1. Dockerfile +49 -35
Dockerfile CHANGED
@@ -1,69 +1,86 @@
1
- FROM python:3.8-slim
 
 
2
 
3
  # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
5
- git wget curl \
6
- libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender-dev libgomp1 \
 
 
 
7
  build-essential \
 
 
 
 
 
 
 
 
 
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
 
 
 
 
 
10
  # Create user
11
  RUN useradd -m -u 1000 user
12
  WORKDIR /app
13
 
14
- # Copy requirements
15
- COPY requirements.txt .
16
 
17
- # Stage 1: Install PyTorch first
18
- RUN pip install --upgrade pip==22.3.1 && \
19
- pip install --no-cache-dir \
20
  torch==1.9.0+cpu \
21
  torchvision==0.10.0+cpu \
22
  torchaudio==0.9.0 \
23
- --extra-index-url https://download.pytorch.org/whl/cpu
24
 
25
- # Stage 2: Install core dependencies
26
  RUN pip install --no-cache-dir \
27
  numpy==1.21.6 \
28
  Pillow==8.3.2 \
29
  cython==0.29.35 \
30
- setuptools==59.5.0
31
 
32
- # Stage 3: Install detectron2
33
  RUN pip install --no-cache-dir \
34
  detectron2==0.6 \
35
  -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.9/index.html
36
 
37
- # Stage 4: Try to install NATTEN (may fail, that's OK)
38
- RUN pip install --no-cache-dir \
39
- natten==0.14.6 \
40
- -f https://shi-labs.com/natten/wheels/cpu/torch1.9/index.html || \
41
- echo "NATTEN installation failed, continuing without it"
42
-
43
- # Stage 5: Install remaining requirements
44
  RUN pip install --no-cache-dir \
45
  opencv-python==4.5.5.64 \
46
- imutils==0.5.4 \
47
  scipy==1.7.3 \
48
- shapely==1.8.5 \
49
- h5py==3.7.0 \
50
  scikit-image==0.19.3 \
51
- scikit-learn \
 
 
 
 
 
52
  timm==0.4.12 \
53
  einops==0.6.1 \
54
- icecream==2.1.3 \
55
- wandb==0.13.5 \
56
  tqdm==4.64.1 \
 
 
 
 
 
 
 
 
57
  ftfy==6.1.1 \
58
  regex==2022.10.31 \
59
  inflect==6.0.4 \
60
  gdown==4.5.4 \
61
  wget==3.2 \
62
- huggingface_hub\
63
- pytorch_lightning==1.8.6 \
64
- gradio==3.35.2 \
65
- diffdist \
66
- submitit==1.4.5
67
 
68
  # Switch to user
69
  USER user
@@ -72,15 +89,12 @@ ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
72
  # Copy application
73
  COPY --chown=user:user . /app
74
 
75
- # Create directories
76
-
77
- # Download example images
78
-
79
- # CPU environment
80
  ENV CUDA_VISIBLE_DEVICES=""
81
  ENV FORCE_CUDA="0"
82
  ENV OMP_NUM_THREADS=4
83
  ENV MKL_NUM_THREADS=4
 
84
 
85
  EXPOSE 7860
86
  CMD ["python", "gradio_test.py"]
 
1
+ FROM ubuntu:18.04
2
+
3
+ ENV DEBIAN_FRONTEND noninteractive
4
 
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
+ git \
8
+ python3.8 \
9
+ python3.8-dev \
10
+ python3-pip \
11
+ python3.8-distutils \
12
  build-essential \
13
+ cmake \
14
+ wget \
15
+ curl \
16
+ libgl1-mesa-glx \
17
+ libglib2.0-0 \
18
+ libsm6 \
19
+ libxext6 \
20
+ libxrender-dev \
21
+ libgomp1 \
22
+ libgcc-7-dev \
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
+ # Set python3.8 as default
26
+ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 && \
27
+ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 && \
28
+ update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
29
+
30
  # Create user
31
  RUN useradd -m -u 1000 user
32
  WORKDIR /app
33
 
34
+ # Install pip for python3.8
35
+ RUN python -m pip install --upgrade pip==22.3.1 setuptools wheel
36
 
37
+ # Install PyTorch CPU with specific versions that work with detectron2
38
+ RUN pip install --no-cache-dir \
 
39
  torch==1.9.0+cpu \
40
  torchvision==0.10.0+cpu \
41
  torchaudio==0.9.0 \
42
+ -f https://download.pytorch.org/whl/torch_stable.html
43
 
44
+ # Install numpy and other core dependencies
45
  RUN pip install --no-cache-dir \
46
  numpy==1.21.6 \
47
  Pillow==8.3.2 \
48
  cython==0.29.35 \
49
+ pycocotools
50
 
51
+ # Install detectron2 - using the exact URL that works
52
  RUN pip install --no-cache-dir \
53
  detectron2==0.6 \
54
  -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.9/index.html
55
 
56
+ # Install OpenCV and other dependencies
 
 
 
 
 
 
57
  RUN pip install --no-cache-dir \
58
  opencv-python==4.5.5.64 \
 
59
  scipy==1.7.3 \
 
 
60
  scikit-image==0.19.3 \
61
+ scikit-learn==1.0.2 \
62
+ matplotlib==3.5.3
63
+
64
+ # Install gradio and other packages
65
+ RUN pip install --no-cache-dir \
66
+ gradio==3.35.2 \
67
  timm==0.4.12 \
68
  einops==0.6.1 \
 
 
69
  tqdm==4.64.1 \
70
+ huggingface_hub==0.14.8 \
71
+ imutils==0.5.4 \
72
+ shapely==1.8.5 \
73
+ h5py==3.7.0
74
+
75
+ # Install remaining packages (skip problematic ones)
76
+ RUN pip install --no-cache-dir \
77
+ icecream==2.1.3 \
78
  ftfy==6.1.1 \
79
  regex==2022.10.31 \
80
  inflect==6.0.4 \
81
  gdown==4.5.4 \
82
  wget==3.2 \
83
+ submitit==1.4.5 || true
 
 
 
 
84
 
85
  # Switch to user
86
  USER user
 
89
  # Copy application
90
  COPY --chown=user:user . /app
91
 
92
+ # Set environment variables
 
 
 
 
93
  ENV CUDA_VISIBLE_DEVICES=""
94
  ENV FORCE_CUDA="0"
95
  ENV OMP_NUM_THREADS=4
96
  ENV MKL_NUM_THREADS=4
97
+ ENV PYTHONUNBUFFERED=1
98
 
99
  EXPOSE 7860
100
  CMD ["python", "gradio_test.py"]