1+ FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04
2+
3+ SHELL ["/bin/bash" , "-c" ]
4+
5+ # Setup Environment Variables
6+ ENV CUDA_HOME=/usr/local/cuda \
7+ PYTHONUNBUFFERED=1 \
8+ TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.6 8.9 9.0+PTX"
9+
10+ # Setup System Utilities
11+ RUN apt-get update --yes --quiet \
12+ && apt-get upgrade --yes --quiet \
13+ && DEBIAN_FRONTEND=noninteractive apt-get install --yes --quiet --no-install-recommends \
14+ apt-utils \
15+ autoconf \
16+ automake \
17+ bc \
18+ build-essential \
19+ ca-certificates \
20+ check \
21+ cmake \
22+ curl \
23+ dmidecode \
24+ emacs \
25+ g++\
26+ gcc \
27+ git \
28+ iproute2 \
29+ jq \
30+ kmod \
31+ libaio-dev \
32+ libcurl4-openssl-dev \
33+ libgl1-mesa-glx \
34+ libglib2.0-0 \
35+ libgomp1 \
36+ libibverbs-dev \
37+ libnuma-dev \
38+ libnuma1 \
39+ libomp-dev \
40+ libsm6 \
41+ libssl-dev \
42+ libsubunit-dev \
43+ libsubunit0 \
44+ libtool \
45+ libxext6 \
46+ libxrender-dev \
47+ make \
48+ moreutils \
49+ net-tools \
50+ ninja-build \
51+ openssh-client \
52+ openssh-server \
53+ openssl \
54+ pkg-config \
55+ python3-dev \
56+ software-properties-common \
57+ sudo \
58+ unzip \
59+ util-linux \
60+ vim \
61+ wget \
62+ zlib1g-dev \
63+ && apt-get autoremove \
64+ && apt-get clean \
65+ && rm -rf /var/lib/apt/lists/
66+
67+ # Setup base Python to bootstrap Mamba
68+ RUN add-apt-repository --yes ppa:deadsnakes/ppa \
69+ && apt-get update --yes --quiet
70+ RUN DEBIAN_FRONTEND=noninteractive apt-get install --yes --quiet --no-install-recommends \
71+ python3.11 \
72+ python3.11-dev \
73+ python3.11-distutils \
74+ python3.11-lib2to3 \
75+ python3.11-gdbm \
76+ python3.11-tk \
77+ pip
78+ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 999 \
79+ && update-alternatives --config python3 \
80+ && ln -s /usr/bin/python3 /usr/bin/python
81+ RUN pip install --upgrade pip
82+
83+ # Setup optimized Mamba environment with required PyTorch dependencies
84+ RUN wget -O /tmp/Miniforge.sh https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Mambaforge-24.3.0-0-Linux-x86_64.sh \
85+ && bash /tmp/Miniforge.sh -b -p /Miniforge \
86+ && source /Miniforge/etc/profile.d/conda.sh \
87+ && source /Miniforge/etc/profile.d/mamba.sh \
88+ && mamba update -y -q -n base -c defaults mamba \
89+ && mamba create -y -q -n Code-Eval python=3.11 setuptools=69.5.1 \
90+ && mamba activate Code-Eval \
91+ && mamba install -y -q -c conda-forge \
92+ charset-normalizer \
93+ gputil \
94+ ipython \
95+ numpy \
96+ pandas \
97+ scikit-learn \
98+ wandb \
99+ && mamba install -y -q -c intel \
100+ "mkl==2023" \
101+ "mkl-static==2023" \
102+ "mkl-include==2023" \
103+ && mamba install -y -q -c pytorch magma-cuda121 \
104+ && mamba clean -a -f -y
105+
106+ # Install VLLM precompiled with appropriate CUDA and ensure PyTorch is installed form the same version channel
107+ RUN source /Miniforge/etc/profile.d/conda.sh \
108+ && source /Miniforge/etc/profile.d/mamba.sh \
109+ && mamba activate Code-Eval \
110+ && pip install https://github.com/vllm-project/vllm/releases/download/v0.4.0/vllm-0.4.0-cp311-cp311-manylinux1_x86_64.whl \
111+ --extra-index-url https://download.pytorch.org/whl/cu121
112+
113+ # Install Flash Attention
114+ RUN source /Miniforge/etc/profile.d/conda.sh \
115+ && source /Miniforge/etc/profile.d/mamba.sh \
116+ && mamba activate Code-Eval \
117+ && export MAX_JOBS=$(($(nproc) - 2)) \
118+ && pip install --no-cache-dir ninja packaging psutil \
119+ && pip install flash-attn==2.5.8 --no-build-isolation
120+
121+ # Add a new user "wildcodeuser"
122+ RUN adduser --disabled-password --gecos "" wildcodeuser
123+
124+ # Acquire benchmark code to local
125+ RUN git clone https://github.com/bigcode-project/code-eval.git /wildcode
126+
127+ RUN chown -R wildcodeuser:wildcodeuser /wildcode
128+ USER wildcodeuser
129+
130+ # Install Code-Eval and pre-load the dataset
131+ RUN source /Miniforge/etc/profile.d/conda.sh \
132+ && source /Miniforge/etc/profile.d/mamba.sh \
133+ && mamba activate Code-Eval \
134+ && pip install wild-code --upgrade \
135+ && python -c "from wildcode.data import get_wildcodebench; get_wildcodebench()"
136+
137+ WORKDIR /wildcode
138+
139+ # Declare an argument for the huggingface token
140+ ARG HF_TOKEN
141+ RUN if [[ -n "$HF_TOKEN" ]] ; then /Miniforge/envs/Code-Eval/bin/huggingface-cli login --token $HF_TOKEN ; \
142+ else echo "No HuggingFace token specified. Access to gated or private models will be unavailable." ; fi
143+
144+ ENTRYPOINT ["/Miniforge/envs/Code-Eval/bin/python" , "-m" , "wildcode.generate" ]
0 commit comments