fffiloni commited on
Commit
1131010
·
verified ·
1 Parent(s): 2e82625

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -34
Dockerfile CHANGED
@@ -26,6 +26,9 @@ RUN useradd -m -u 1000 user
26
 
27
  USER user
28
 
 
 
 
29
  ENV HOME=/home/user \
30
  PATH=/home/user/.local/bin:$PATH \
31
  PYTHONPATH=$HOME/app \
@@ -35,9 +38,11 @@ ENV HOME=/home/user \
35
  GRADIO_SERVER_NAME=0.0.0.0 \
36
  GRADIO_THEME=huggingface \
37
  GRADIO_SHARE=False \
38
- SYSTEM=spaces \
39
- CUDA_HOME=/usr/local/cuda \
40
- LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
 
 
41
 
42
  # Set the environment variable to specify the GPU device
43
  ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
@@ -96,42 +101,13 @@ RUN python -c "from third_party.CSD import model; print('CSD model successfully
96
 
97
 
98
  # Install LangSAM and its dependencies
99
- RUN pip install --no-cache-dir segment-anything==1.0 && \
 
100
  git clone https://github.com/luca-medeiros/lang-segment-anything && \
101
  cd lang-segment-anything && \
102
  pip install -e . && \
103
  cd ..
104
 
105
- # Install GroundingDINO via pip
106
- RUN pip install --no-cache-dir git+https://github.com/IDEA-Research/GroundingDINO.git
107
-
108
- # Verify the installed package structure
109
- RUN find /home/user/.local/lib/python3.10/site-packages/groundingdino -type f
110
-
111
- # Create a custom setup.py for GroundingDINO extension
112
- RUN echo "from setuptools import setup\n\
113
- from torch.utils.cpp_extension import BuildExtension, CUDAExtension\n\
114
- \n\
115
- setup(\n\
116
- name='groundingdino',\n\
117
- ext_modules=[\n\
118
- CUDAExtension(\n\
119
- name='_C',\n\
120
- sources=['/home/user/.local/lib/python3.10/site-packages/groundingdino/models/GroundingDINO/csrc/ms_deform_attn.cpp', '/home/user/.local/lib/python3.10/site-packages/groundingdino/models/GroundingDINO/csrc/ms_deform_attn_cuda.cu'],\n\
121
- extra_compile_args={'cxx': ['-g'], 'nvcc': ['-O2', '-arch=sm_70']},\n\
122
- ),\n\
123
- ],\n\
124
- cmdclass={\n\
125
- 'build_ext': BuildExtension\n\
126
- }\n\
127
- )" > /home/user/setup_groundingdino.py
128
-
129
- # Compile the GroundingDINO custom C++ operations
130
- RUN cd /home/user && \
131
- python setup_groundingdino.py build_ext --inplace && \
132
- rm setup_groundingdino.py
133
-
134
-
135
  # Upgrade pip and install Gradio
136
  RUN python3 -m pip install --no-cache-dir gradio
137
 
 
26
 
27
  USER user
28
 
29
+ # Verify CUDA installation path
30
+ RUN find /usr/local -type d -name "cuda*"
31
+
32
  ENV HOME=/home/user \
33
  PATH=/home/user/.local/bin:$PATH \
34
  PYTHONPATH=$HOME/app \
 
38
  GRADIO_SERVER_NAME=0.0.0.0 \
39
  GRADIO_THEME=huggingface \
40
  GRADIO_SHARE=False \
41
+ SYSTEM=spaces
42
+
43
+ # Set CUDA_HOME environment variable
44
+ ENV CUDA_HOME=/usr/local/cuda-11.8
45
+ ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
46
 
47
  # Set the environment variable to specify the GPU device
48
  ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
 
101
 
102
 
103
  # Install LangSAM and its dependencies
104
+ RUN pip install --no-cache-dir git+https://github.com/IDEA-Research/GroundingDINO.git && \
105
+ pip install --no-cache-dir segment-anything==1.0 && \
106
  git clone https://github.com/luca-medeiros/lang-segment-anything && \
107
  cd lang-segment-anything && \
108
  pip install -e . && \
109
  cd ..
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  # Upgrade pip and install Gradio
112
  RUN python3 -m pip install --no-cache-dir gradio
113