daquanzhou commited on
Commit
9571c45
1 Parent(s): 276836f

update Dockerfile

Browse files
Files changed (2) hide show
  1. Dockerfile +40 -4
  2. requirements.txt +16 -2
Dockerfile CHANGED
@@ -1,14 +1,50 @@
1
- # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
 
4
- FROM python:3.9
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  WORKDIR /code
7
 
8
  COPY ./requirements.txt /code/requirements.txt
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
 
 
 
 
 
12
  COPY . .
13
 
14
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
+ FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
 
2
 
3
+ ENV DEBIAN_FRONTEND=noninteractive \
4
+ TZ=America/Los_Angeles
5
+
6
+ ARG USE_PERSISTENT_DATA
7
+
8
+ RUN apt-get update && apt-get install -y \
9
+ git \
10
+ make build-essential libssl-dev zlib1g-dev \
11
+ libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
12
+ libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git-lfs \
13
+ ffmpeg libsm6 libxext6 cmake libgl1-mesa-glx \
14
+ && rm -rf /var/lib/apt/lists/* \
15
+ && git lfs install
16
 
17
  WORKDIR /code
18
 
19
  COPY ./requirements.txt /code/requirements.txt
20
 
21
+ # User
22
+ RUN useradd -m -u 1000 user
23
+ USER user
24
+ ENV HOME=/home/user \
25
+ PATH=/home/user/.local/bin:$PATH
26
+
27
+ # Pyenv
28
+ RUN curl https://pyenv.run | bash
29
+ ENV PATH=$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH
30
+
31
+ ARG PYTHON_VERSION=3.9.17
32
+ # Python
33
+ RUN pyenv install $PYTHON_VERSION && \
34
+ pyenv global $PYTHON_VERSION && \
35
+ pyenv rehash && \
36
+ pip install --no-cache-dir --upgrade pip setuptools wheel && \
37
+ pip install --no-cache-dir \
38
+ datasets \
39
+ huggingface-hub "protobuf<4" "click<8.1"
40
+
41
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
42
 
43
+ # Set the working directory to /data if USE_PERSISTENT_DATA is set, otherwise set to $HOME/app
44
+ WORKDIR $HOME/app
45
+
46
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
47
  COPY . .
48
 
49
+ # Checkpoints
50
+ CMD ["python", "main.py", "--listen", "0.0.0.0", "--cpu", "--port", "7860", "--output-directory", "${USE_PERSISTENT_DATA:+/data/}"]
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
- torch
2
  torchsde
3
- torchvision
4
  einops
5
  transformers>=4.25.1
6
  safetensors>=0.3.0
@@ -10,3 +10,17 @@ Pillow
10
  scipy
11
  tqdm
12
  psutil
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ torch==2.0.0
2
  torchsde
3
+ torchvision>=0.15.1
4
  einops
5
  transformers>=4.25.1
6
  safetensors>=0.3.0
 
10
  scipy
11
  tqdm
12
  psutil
13
+ numba
14
+ colour-science
15
+ rembg
16
+ pandas
17
+ numexpr
18
+ segment-anything
19
+ scikit-image
20
+ piexif
21
+ opencv-python-headless
22
+ GitPython
23
+ matrix-client==0.4.0
24
+ huggingface-hub>0.20
25
+ opencv-python
26
+ imageio-ffmpeg