-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
ARG BASE_IMAGE=livepeer/ai-runner:live-base | ||
FROM ${BASE_IMAGE} | ||
|
||
# Download and install the NVIDIA TensorRT repository local deb | ||
RUN wget https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.6.1/local_repos/nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-12.0_1.0-1_amd64.deb && \ | ||
dpkg -i nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-12.0_1.0-1_amd64.deb && \ | ||
cp /var/nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-12.0/*-keyring.gpg /usr/share/keyrings/ && \ | ||
rm nv-tensorrt-local-repo-ubuntu2204-8.6.1-cuda-12.0_1.0-1_amd64.deb | ||
|
||
# Install TensorRT Python library | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends tensorrt && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install cmake and build dependencies for grid-sample3d-trt-plugin | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends cmake build-essential && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Build grid-sample3d-trt-plugin for FasterLivePortrait | ||
RUN git clone https://github.com/SeanWangJS/grid-sample3d-trt-plugin.git /opt/grid-sample3d-trt-plugin && \ | ||
cd /opt/grid-sample3d-trt-plugin && \ | ||
sed -i 's/set_target_properties(${PROJECT_NAME} PROPERTIES CUDA_ARCHITECTURES ".*")/set_target_properties(${PROJECT_NAME} PROPERTIES CUDA_ARCHITECTURES "60;70;75;80;86")/' CMakeLists.txt && \ | ||
mkdir build && cd build && \ | ||
export PATH=/usr/local/cuda/bin:$PATH && \ | ||
cmake .. -DTensorRT_ROOT=/usr/include && \ | ||
make | ||
|
||
# Install required Python version | ||
ARG PYTHON_VERSION=3.10 | ||
RUN pyenv install $PYTHON_VERSION && \ | ||
pyenv global $PYTHON_VERSION && \ | ||
pyenv rehash | ||
|
||
# Upgrade pip and install required packages | ||
ARG PIP_VERSION=23.3.2 | ||
ENV PIP_PREFER_BINARY=1 | ||
RUN pip install --no-cache-dir --upgrade pip==${PIP_VERSION} setuptools==69.5.1 wheel==0.43.0 | ||
|
||
# Install Python TensorRT packages | ||
RUN pip install --no-cache-dir tensorrt==8.6.1 numpy==1.26.4 | ||
|
||
# Clone the FasterLivePortrait repository | ||
RUN mkdir -p /app/app/live && git clone https://github.com/warmshao/FasterLivePortrait.git /app/app/live/FasterLivePortrait | ||
WORKDIR /app/app/live/FasterLivePortrait | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Create a symlink on ./checkpoints to the directory that is mounted with the models | ||
# TODO: Figure out if we can have only 1 of these symlinks | ||
RUN ln -s /models/FasterLivePortrait ./checkpoints | ||
RUN ln -s /models/FasterLivePortrait /app/app/checkpoints | ||
RUN ln -s /models/FasterLivePortrait /app/app/live/checkpoints |