* Create Dockerfile.k8s * Update Dockerfile More slim standalone image * Update Dockerfile * Update Dockerfile.k8s * Update bigdl-qlora-finetuing-entrypoint.sh * Update qlora_finetuning_cpu.py * Update alpaca_qlora_finetuning_cpu.py Refer to this [pr](https://github.com/intel-analytics/BigDL/pull/9551/files#diff-2025188afa54672d21236e6955c7c7f7686bec9239532e41c7983858cc9aaa89), update the LoraConfig * update * update * update * update * update * update * update * update transformer version * update Dockerfile * update Docker image name * fix error
73 lines
3.1 KiB
Docker
73 lines
3.1 KiB
Docker
# USE TO BUILD A MORE SLIM IMAGE FOR K8S
|
|
FROM ubuntu:20.04 as key-getter
|
|
ARG http_proxy
|
|
ARG https_proxy
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y curl gpg && \
|
|
curl -fsSL https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | gpg --dearmor | tee /root/intel-oneapi-archive-keyring.gpg
|
|
|
|
FROM debian:bullseye as builder
|
|
|
|
ARG http_proxy
|
|
ARG https_proxy
|
|
ENV TZ=Asia/Shanghai
|
|
ARG PIP_NO_CACHE_DIR=false
|
|
ENV TRANSFORMERS_COMMIT_ID=95fe0f5
|
|
|
|
# add public key
|
|
COPY --from=key-getter /root/intel-oneapi-archive-keyring.gpg /usr/share/keyrings/intel-oneapi-archive-keyring.gpg
|
|
RUN echo "deb [signed-by=/usr/share/keyrings/intel-oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main " > /etc/apt/sources.list.d/oneAPI.list
|
|
|
|
RUN mkdir -p /bigdl/data && mkdir -p /bigdl/model && \
|
|
apt-get update && \
|
|
apt install -y --no-install-recommends openssh-server openssh-client libcap2-bin gnupg2 ca-certificates \
|
|
python3-pip python3.9-dev python3-wheel python3.9-distutils git software-properties-common && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
mkdir -p /var/run/sshd && \
|
|
setcap CAP_NET_BIND_SERVICE=+eip /usr/sbin/sshd && \
|
|
apt remove libcap2-bin -y && \
|
|
sed -i "s/[ #]\(.*StrictHostKeyChecking \).*/ \1no/g" /etc/ssh/ssh_config && \
|
|
echo " UserKnownHostsFile /dev/null" >> /etc/ssh/ssh_config && \
|
|
sed -i "s/[ #]\(.*Port \).*/ \1$port/g" /etc/ssh/ssh_config && \
|
|
sed -i "s/#\(StrictModes \).*/\1no/g" /etc/ssh/sshd_config && \
|
|
sed -i "s/#\(Port \).*/\1$port/g" /etc/ssh/sshd_config && \
|
|
useradd -m mpiuser && \
|
|
cp -r /etc/ssh/sshd_config /home/mpiuser/.sshd_config && \
|
|
echo "Port $port" >> /home/mpiuser/.sshd_config && \
|
|
# install pytorch 2.1.0
|
|
pip3 install --upgrade pip && \
|
|
export PIP_DEFAULT_TIMEOUT=100 && \
|
|
pip install --upgrade torch==2.1.0 --index-url https://download.pytorch.org/whl/cpu && \
|
|
# install CPU bigdl-llm
|
|
pip3 install --pre --upgrade bigdl-llm[all] && \
|
|
# install ipex and oneccl
|
|
pip install intel_extension_for_pytorch==2.0.100 && \
|
|
pip install oneccl_bind_pt -f https://developer.intel.com/ipex-whl-stable && \
|
|
# install huggingface dependencies
|
|
pip install datasets transformers==4.35.0 && \
|
|
pip install fire peft==0.5.0 && \
|
|
pip install accelerate==0.23.0 && \
|
|
# install basic dependencies
|
|
apt-get update && apt-get install -y curl wget gpg gpg-agent software-properties-common libunwind8-dev && \
|
|
# Install Intel oneAPI keys.
|
|
apt remove -y gnupg2 ca-certificates && \
|
|
apt autoremove -y && \
|
|
apt update && \
|
|
apt install -y --no-install-recommends dnsutils intel-oneapi-mpi && \
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
# get qlora example code
|
|
ln -s /usr/bin/python3 /usr/bin/python && \
|
|
cd /bigdl && \
|
|
git clone https://github.com/intel-analytics/BigDL.git && \
|
|
mv BigDL/python/llm/example/CPU/QLoRA-FineTuning/* . && \
|
|
rm -r BigDL && \
|
|
chown -R mpiuser /bigdl
|
|
|
|
# for standalone
|
|
COPY ./start-qlora-finetuning-on-cpu.sh /bigdl/start-qlora-finetuning-on-cpu.sh
|
|
|
|
USER mpiuser
|
|
|
|
ENTRYPOINT ["/bin/bash"]
|