Yuliang commited on
Commit
e8a8a6b
1 Parent(s): d04931b

update voxelize_cuda

Browse files
Files changed (3) hide show
  1. Dockerfile +34 -33
  2. app.py +7 -0
  3. requirements.txt +2 -1
Dockerfile CHANGED
@@ -1,47 +1,50 @@
1
- FROM nvidia/cuda:11.3.1-devel-ubuntu20.04
2
 
3
  ARG DEBIAN_FRONTEND=noninteractive
4
 
5
- # Set up a new user named "user" with user ID 1000
6
- RUN useradd -m -u 1000 user
7
- # Switch to the "user" user
8
- USER user
9
-
10
- ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6"
11
- ENV TCNN_CUDA_ARCHITECTURES=86;80;75;70;61;60
12
- ENV FORCE_CUDA=1
13
-
14
  RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
15
- build-essential \
16
- curl \
17
- git \
 
 
 
 
18
  libegl1-mesa-dev \
19
  libgl1-mesa-dev \
20
  libgles2-mesa-dev \
21
  libglib2.0-0 \
22
- libsm6 \
23
- libxext6 \
24
  libxrender1 \
25
- python-is-python3 \
 
 
26
  python3.8 \
27
  python3-pip \
28
- wget \
29
- libgl1 \
30
- freeglut3-dev \
31
- unzip \
32
- ffmpeg \
33
- libgl1-mesa-dri \
34
- libegl1-mesa \
35
- libgbm1 \
36
- libturbojpeg \
37
  && rm -rf /var/lib/apt/lists/*
38
 
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  ENV CUDA_HOME=/usr/local/cuda
41
- ENV PATH=${CUDA_HOME}/bin:/home/user/.local/bin:/usr/bin:${PATH}
42
  ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
43
  ENV LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH}
44
 
 
45
  # Set home to the user's home directory
46
  ENV HOME=/home/user \
47
  PYTHONPATH=$HOME/app \
@@ -52,19 +55,13 @@ ENV HOME=/home/user \
52
  GRADIO_THEME=huggingface \
53
  SYSTEM=spaces
54
 
55
- FROM python:3.8
56
-
57
  RUN pip install --upgrade pip ninja
58
  RUN pip install setuptools==69.5.1
59
  RUN pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
60
 
61
  RUN python -c "import torch; print(torch.version.cuda)"
62
  COPY requirements.txt /tmp
63
- RUN cd /tmp && pip install -r requirements.txt --user
64
-
65
- RUN git clone git+https://github.com/YuliangXiu/neural_voxelization_layer.git /home/user/neural_voxelization_layer
66
- WORKDIR /home/user/neural_voxelization_layer
67
- RUN python setup.py install --user
68
 
69
  RUN pip install https://download.is.tue.mpg.de/icon/HF/kaolin-0.11.0-cp38-cp38-linux_x86_64.whl
70
  RUN pip install https://download.is.tue.mpg.de/icon/HF/pytorch3d-0.7.0-cp38-cp38-linux_x86_64.whl
@@ -74,5 +71,9 @@ WORKDIR $HOME/app
74
 
75
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
76
  COPY --chown=user . $HOME/app
 
 
 
 
77
 
78
  CMD ["python", "app.py"]
 
1
+ FROM nvidia/cuda:11.3.1-cudnn8-devel-ubuntu20.04
2
 
3
  ARG DEBIAN_FRONTEND=noninteractive
4
 
 
 
 
 
 
 
 
 
 
5
  RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
6
+ libgl1 \
7
+ freeglut3-dev \
8
+ unzip \
9
+ ffmpeg \
10
+ libsm6 \
11
+ libxext6 \
12
+ libfontconfig1 \
13
  libegl1-mesa-dev \
14
  libgl1-mesa-dev \
15
  libgles2-mesa-dev \
16
  libglib2.0-0 \
 
 
17
  libxrender1 \
18
+ libgbm1 \
19
+ build-essential \
20
+ libeigen3-dev \
21
  python3.8 \
22
  python3-pip \
23
+ nvidia-cuda-toolkit \
24
+ opencv-python-headless \
 
 
 
 
 
 
 
25
  && rm -rf /var/lib/apt/lists/*
26
 
27
 
28
+ # Set up a new user named "user" with user ID 1000
29
+ RUN useradd -m -u 1000 user
30
+
31
+ # Switch to the "user" user
32
+ USER user
33
+
34
+ FROM python:3.8
35
+
36
+ ENV PYTHONUNBUFFERED=1
37
+
38
+ ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6"
39
+ ENV TCNN_CUDA_ARCHITECTURES=86;80;75;70;61;60
40
+ ENV FORCE_CUDA=1
41
+
42
  ENV CUDA_HOME=/usr/local/cuda
43
+ ENV PATH=${CUDA_HOME}/bin:/home/${USER_NAME}/.local/bin:/usr/bin:${PATH}
44
  ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
45
  ENV LIBRARY_PATH=${CUDA_HOME}/lib64/stubs:${LIBRARY_PATH}
46
 
47
+
48
  # Set home to the user's home directory
49
  ENV HOME=/home/user \
50
  PYTHONPATH=$HOME/app \
 
55
  GRADIO_THEME=huggingface \
56
  SYSTEM=spaces
57
 
 
 
58
  RUN pip install --upgrade pip ninja
59
  RUN pip install setuptools==69.5.1
60
  RUN pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
61
 
62
  RUN python -c "import torch; print(torch.version.cuda)"
63
  COPY requirements.txt /tmp
64
+ RUN cd /tmp && pip install -r requirements.txt
 
 
 
 
65
 
66
  RUN pip install https://download.is.tue.mpg.de/icon/HF/kaolin-0.11.0-cp38-cp38-linux_x86_64.whl
67
  RUN pip install https://download.is.tue.mpg.de/icon/HF/pytorch3d-0.7.0-cp38-cp38-linux_x86_64.whl
 
71
 
72
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
73
  COPY --chown=user . $HOME/app
74
+ RUN chmod 755 $HOME/app
75
+
76
+ ENV TRANSFORMERS_CACHE=/tmp
77
+ ENV MPLCONFIGDIR=/tmp
78
 
79
  CMD ["python", "app.py"]
app.py CHANGED
@@ -4,9 +4,16 @@
4
  import glob
5
  import gradio as gr
6
  import numpy as np
 
 
7
 
8
  from apps.infer import generate_model
9
 
 
 
 
 
 
10
  # running
11
 
12
  description = '''
 
4
  import glob
5
  import gradio as gr
6
  import numpy as np
7
+ import os
8
+ import subprocess
9
 
10
  from apps.infer import generate_model
11
 
12
+ if os.getenv('SYSTEM') == 'spaces':
13
+ subprocess.run('pip install pyembree'.split())
14
+ subprocess.run(
15
+ 'pip install git+https://github.com/YuliangXiu/neural_voxelization_layer.git'.split())
16
+
17
  # running
18
 
19
  description = '''
requirements.txt CHANGED
@@ -16,7 +16,7 @@ shapely==1.7.1
16
  rtree==0.9.7
17
  pytorch_lightning==1.2.5
18
  PyMCubes
19
- opencv-python
20
  opencv_contrib_python
21
  scikit-learn
22
  protobuf==3.20.0
@@ -25,4 +25,5 @@ iopath
25
  fvcore
26
  chumpy
27
  open3d
 
28
  git+https://github.com/YuliangXiu/rembg.git
 
16
  rtree==0.9.7
17
  pytorch_lightning==1.2.5
18
  PyMCubes
19
+ opencv-python-headless==4.8.1.78
20
  opencv_contrib_python
21
  scikit-learn
22
  protobuf==3.20.0
 
25
  fvcore
26
  chumpy
27
  open3d
28
+ gradio
29
  git+https://github.com/YuliangXiu/rembg.git