60 lines
2.5 KiB
Django/Jinja
60 lines
2.5 KiB
Django/Jinja
FROM axolotlai/axolotl-base-uv:{{ BASE_TAG }}
|
|
|
|
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
|
|
|
|
ARG VENV_PYTHON="/workspace/axolotl-venv/bin/python"
|
|
|
|
ENV TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.6 9.0+PTX"
|
|
ENV AXOLOTL_EXTRAS="{{ AXOLOTL_EXTRAS }}"
|
|
ENV AXOLOTL_ARGS="{{ AXOLOTL_ARGS }}"
|
|
ENV CUDA="{{ CUDA }}"
|
|
ENV PYTORCH_VERSION="{{ PYTORCH_VERSION }}"
|
|
ENV GITHUB_REF="{{ GITHUB_REF }}"
|
|
ENV GITHUB_SHA="{{ GITHUB_SHA }}"
|
|
ENV NIGHTLY_BUILD="{{ NIGHTLY_BUILD }}"
|
|
ENV HF_HOME="{{ HF_HOME }}"
|
|
ENV VENV_PYTHON=$VENV_PYTHON
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y --allow-change-held-packages vim curl nano libnccl2 libnccl-dev ibverbs-providers ibverbs-utils infiniband-diags librdmacm-dev librdmacm1 rdmacm-utils slurm-wlm
|
|
|
|
WORKDIR /workspace
|
|
|
|
RUN git clone --depth=1 https://github.com/axolotl-ai-cloud/axolotl.git
|
|
|
|
WORKDIR /workspace/axolotl
|
|
|
|
RUN git fetch origin +$GITHUB_REF && \
|
|
git checkout FETCH_HEAD
|
|
|
|
# If AXOLOTL_EXTRAS is set, append it in brackets
|
|
RUN if [ "$NIGHTLY_BUILD" = "true" ] ; then \
|
|
sed -i 's#"transformers[^"]*"#"transformers @ git+https://github.com/huggingface/transformers.git@main"#' pyproject.toml; \
|
|
sed -i 's#"peft[^"]*"#"peft @ git+https://github.com/huggingface/peft.git@main"#' pyproject.toml; \
|
|
sed -i 's#"accelerate[^"]*"#"accelerate @ git+https://github.com/huggingface/accelerate.git@main"#' pyproject.toml; \
|
|
sed -i 's#"trl[^"]*"#"trl @ git+https://github.com/huggingface/trl.git@main"#' pyproject.toml; \
|
|
sed -i 's#"datasets[^"]*"#"datasets @ git+https://github.com/huggingface/datasets.git@main"#' pyproject.toml; \
|
|
fi
|
|
|
|
RUN uv pip install --python "$VENV_PYTHON" packaging==23.2 setuptools==75.8.0 pip
|
|
RUN if [ "$AXOLOTL_EXTRAS" != "" ] ; then \
|
|
uv pip install --python "$VENV_PYTHON" --no-build-isolation -e .[ring-flash-attn,optimizers,ray,${AXOLOTL_EXTRAS}] $AXOLOTL_ARGS; \
|
|
else \
|
|
uv pip install --python "$VENV_PYTHON" --no-build-isolation -e .[ring-flash-attn,optimizers,ray] $AXOLOTL_ARGS; \
|
|
fi
|
|
|
|
RUN uv pip install --python "$VENV_PYTHON" --no-build-isolation flash-attn $AXOLOTL_ARGS
|
|
|
|
RUN "$VENV_PYTHON" scripts/unsloth_install.py | sh
|
|
RUN "$VENV_PYTHON" scripts/cutcrossentropy_install.py | sh
|
|
|
|
# So we can test the Docker image
|
|
RUN uv pip install --python "$VENV_PYTHON" -e ".[dev]"
|
|
|
|
# fix so that git fetch/pull from remote works
|
|
RUN git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && \
|
|
git config --get remote.origin.fetch
|
|
|
|
# helper for huggingface-login cli
|
|
RUN git config --global credential.helper store
|