Dockerfile 1.69 KB
Newer Older
helloyongyang's avatar
helloyongyang committed
1
2
FROM nvidia/cuda:12.8.0-cudnn-devel-ubuntu22.04 AS base

Dongz's avatar
Dongz committed
3
WORKDIR /workspace
helloyongyang's avatar
helloyongyang committed
4
5
6
7
8

ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8

Dongz's avatar
Dongz committed
9
10
11
# use tsinghua source
RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|https://mirrors.tuna.tsinghua.edu.cn/ubuntu/|g' /etc/apt/sources.list \
    && sed -i 's|http://security.ubuntu.com/ubuntu/|https://mirrors.tuna.tsinghua.edu.cn/ubuntu/|g' /etc/apt/sources.list
helloyongyang's avatar
helloyongyang committed
12

Dongz's avatar
Dongz committed
13
14
15
16
17
18
19
20
RUN apt-get update && apt install -y software-properties-common  \
    && add-apt-repository ppa:deadsnakes/ppa \
    && apt-get update \
    && apt-get install -y vim tmux zip unzip wget git cmake build-essential \
     curl libibverbs-dev ca-certificates iproute2 \
     ffmpeg libsm6 libxext6 \
    && apt-get install -y python3.11 python3.11-venv python3.11-dev python3-pip \
    && apt-get clean && rm -rf /var/lib/apt/lists/*
helloyongyang's avatar
helloyongyang committed
21

Dongz's avatar
Dongz committed
22
23
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 \
    && update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1
helloyongyang's avatar
helloyongyang committed
24

Dongz's avatar
Dongz committed
25
26
27
28
RUN pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple \
    && pip install packaging ninja vllm torch torchvision diffusers transformers \
     tokenizers accelerate safetensors opencv-python numpy imageio imageio-ffmpeg \
     einops loguru sgl-kernel qtorch ftfy
helloyongyang's avatar
helloyongyang committed
29

Dongz's avatar
Dongz committed
30
# please download flash-attention source code first
helloyongyang's avatar
helloyongyang committed
31
# git clone https://github.com/Dao-AILab/flash-attention.git --recursive
Dongz's avatar
Dongz committed
32
# todo: add third party repo feature
helloyongyang's avatar
helloyongyang committed
33
34
COPY flash-attention /workspace/flash-attention

Dongz's avatar
Dongz committed
35
# install flash-attention 2
helloyongyang's avatar
helloyongyang committed
36
37
RUN cd flash-attention && pip install --no-cache-dir -v -e .

Dongz's avatar
Dongz committed
38
# install flash-attention 3, only if hopper
helloyongyang's avatar
helloyongyang committed
39
RUN cd flash-attention/hopper && pip install --no-cache-dir -v -e .