-
Notifications
You must be signed in to change notification settings - Fork 219
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (42 loc) · 2.12 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (42 loc) · 2.12 KB
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
55
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
FROM python:3.11-slim
# Set this to "cpu" or "gpu" or etc
ARG ARCH="cpu"
ENV LANG=C.UTF-8
RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
curl \
git \
git-lfs && \
git lfs install
RUN useradd -m -s /bin/bash user && \
mkdir -p /home/user && \
chown -R user:user /home/user/
RUN mkdir /home/user/model && chown user:user -R /home/user/model
COPY --chown=user:user comps /home/user/comps
WORKDIR /home/user/comps/third_parties/video-llama/src
# install the fixed torch version again after install cpu requirements, make sure the deps are compatible
ARG uvpip='uv pip install --system --no-cache-dir'
RUN pip install --no-cache-dir --upgrade pip setuptools uv && \
if [ ${ARCH} = "cpu" ]; then \
$uvpip torch==2.5.1 torchaudio~=2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cpu; \
$uvpip -r /home/user/comps/third_parties/video-llama/src/requirements-cpu.txt; \
else \
$uvpip -r /home/user/comps/third_parties/video-llama/src/requirements-gpu.txt; \
fi
ARG VIDEO_LLAMA_REPO=https://github.com/DAMO-NLP-SG/Video-LLaMA.git
ARG VIDEO_LLAMA_COMMIT=0adb19e829254b46a442ee78cdcd609a988c5de7
RUN git clone --depth=1 ${VIDEO_LLAMA_REPO} && \
cd Video-LLaMA && \
git fetch --depth=1 origin ${VIDEO_LLAMA_COMMIT} && \
git checkout ${VIDEO_LLAMA_COMMIT} && \
git apply --whitespace=fix ../video-llama.patch && \
mv video_llama ../ && \
cd .. && \
rm -rf Video-LLaMA
# Modify the degradations.py file to import rgb_to_grayscale from torchvision.transforms.functional
RUN sed -i 's/from torchvision.transforms.functional_tensor import rgb_to_grayscale/from torchvision.transforms.functional import rgb_to_grayscale/' /usr/local/lib/python3.11/site-packages/pytorchvideo/transforms/augmentations.py && \
sed -i 's/torchvision.transforms.functional_tensor/torchvision.transforms.v2.functional/' /usr/local/lib/python3.11/site-packages/pytorchvideo/transforms/augmentations.py
USER user
ENV PYTHONPATH=/home/user
ENTRYPOINT ["bash", "start.sh"]