add flash-attn installation flag in Dockerfile

This commit is contained in:
hzhaoy 2024-06-27 00:11:04 +08:00
parent c88b1be9f3
commit e19491b0f0
4 changed files with 9 additions and 3 deletions

View File

@ -444,6 +444,7 @@ docker build -f ./docker/docker-cuda/Dockerfile \
--build-arg INSTALL_BNB=false \
--build-arg INSTALL_VLLM=false \
--build-arg INSTALL_DEEPSPEED=false \
--build-arg INSTALL_FLASH_ATTN=false \
--build-arg PIP_INDEX=https://pypi.org/simple \
-t llamafactory:latest .

View File

@ -444,6 +444,7 @@ docker build -f ./docker/docker-cuda/Dockerfile \
--build-arg INSTALL_BNB=false \
--build-arg INSTALL_VLLM=false \
--build-arg INSTALL_DEEPSPEED=false \
--build-arg INSTALL_FLASH_ATTN=false \
--build-arg PIP_INDEX=https://pypi.org/simple \
-t llamafactory:latest .

View File

@ -6,6 +6,7 @@ FROM nvcr.io/nvidia/pytorch:24.02-py3
ARG INSTALL_BNB=false
ARG INSTALL_VLLM=false
ARG INSTALL_DEEPSPEED=false
ARG INSTALL_FLASH_ATTN=false
ARG PIP_INDEX=https://pypi.org/simple
# Set the working directory
@ -36,9 +37,11 @@ RUN EXTRA_PACKAGES="metrics"; \
pip uninstall -y transformer-engine flash-attn
# Rebuild flash-attn
RUN ninja --version || \
(pip uninstall -y ninja && pip install ninja) && \
MAX_JOBS=4 pip install --no-cache-dir flash-attn --no-build-isolation
RUN if [ "$INSTALL_FLASH_ATTN" = "true" ]; then \
ninja --version || \
(pip uninstall -y ninja && pip install ninja) && \
MAX_JOBS=4 pip install --no-cache-dir flash-attn --no-build-isolation \
fi;
# Set up volumes
VOLUME [ "/root/.cache/huggingface", "/root/.cache/modelscope", "/app/data", "/app/output" ]

View File

@ -7,6 +7,7 @@ services:
INSTALL_BNB: false
INSTALL_VLLM: false
INSTALL_DEEPSPEED: false
INSTALL_FLASH_ATTN: false
PIP_INDEX: https://pypi.org/simple
container_name: llamafactory
volumes: