File size: 1,611 Bytes
96da58e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
ARG BASE=nvidia/cuda:12.6.2-devel-ubuntu22.04
FROM ${BASE} AS hamer

# Install OS dependencies:
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends --fix-missing \
    gcc g++ \
    make \
    python3 python3-dev python3-pip python3-venv python3-wheel \
    espeak-ng libsndfile1-dev \
    git \
    wget \
    ffmpeg \
    libsm6 libxext6 \
    libglfw3-dev libgles2-mesa-dev \
    && rm -rf /var/lib/apt/lists/*

# Install hamer:
WORKDIR /app

# Create virtual environment:
RUN python3 -m venv /opt/venv

# Add virtual environment to PATH
ENV PATH="/opt/venv/bin:$PATH"

# Activate virtual environment and install dependencies:
# REVIEW: We need to install/upgrade wheel and setuptools first because otherwise installation fails:
RUN --mount=type=cache,target=/root/.cache/pip \
    pip install --upgrade wheel setuptools

# Install torch and torchvision:
RUN --mount=type=cache,target=/root/.cache/pip \
    pip install torch==2.2.0 torchvision==0.17.0 --index-url https://download.pytorch.org/whl/cu118

# REVIEW: Numpy is installed separately because otherwise installation fails:
RUN --mount=type=cache,target=/root/.cache/pip \
    pip install numpy

# Install gdown (used for fetching scripts):
RUN --mount=type=cache,target=/root/.cache/pip \
    pip install gdown

# Install third-party dependencies ViTPose:
COPY third-party/ third-party/
RUN --mount=type=cache,target=/root/.cache/pip \
    pip install -v -e third-party/ViTPose

# Install project dependencies:
COPY . .
# Install hamer:
RUN --mount=type=cache,target=/root/.cache/pip \
    pip install -e .[all]