Merge pull request #4461 from hzhaoy/feature/support-flash-attn
support flash-attn in Dockerfile
This commit is contained in:
commit
64b131dcfa
|
@ -444,6 +444,7 @@ docker build -f ./docker/docker-cuda/Dockerfile \
|
||||||
--build-arg INSTALL_BNB=false \
|
--build-arg INSTALL_BNB=false \
|
||||||
--build-arg INSTALL_VLLM=false \
|
--build-arg INSTALL_VLLM=false \
|
||||||
--build-arg INSTALL_DEEPSPEED=false \
|
--build-arg INSTALL_DEEPSPEED=false \
|
||||||
|
--build-arg INSTALL_FLASH_ATTN=false \
|
||||||
--build-arg PIP_INDEX=https://pypi.org/simple \
|
--build-arg PIP_INDEX=https://pypi.org/simple \
|
||||||
-t llamafactory:latest .
|
-t llamafactory:latest .
|
||||||
|
|
||||||
|
|
|
@ -444,6 +444,7 @@ docker build -f ./docker/docker-cuda/Dockerfile \
|
||||||
--build-arg INSTALL_BNB=false \
|
--build-arg INSTALL_BNB=false \
|
||||||
--build-arg INSTALL_VLLM=false \
|
--build-arg INSTALL_VLLM=false \
|
||||||
--build-arg INSTALL_DEEPSPEED=false \
|
--build-arg INSTALL_DEEPSPEED=false \
|
||||||
|
--build-arg INSTALL_FLASH_ATTN=false \
|
||||||
--build-arg PIP_INDEX=https://pypi.org/simple \
|
--build-arg PIP_INDEX=https://pypi.org/simple \
|
||||||
-t llamafactory:latest .
|
-t llamafactory:latest .
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ FROM nvcr.io/nvidia/pytorch:24.02-py3
|
||||||
ARG INSTALL_BNB=false
|
ARG INSTALL_BNB=false
|
||||||
ARG INSTALL_VLLM=false
|
ARG INSTALL_VLLM=false
|
||||||
ARG INSTALL_DEEPSPEED=false
|
ARG INSTALL_DEEPSPEED=false
|
||||||
|
ARG INSTALL_FLASH_ATTN=false
|
||||||
ARG PIP_INDEX=https://pypi.org/simple
|
ARG PIP_INDEX=https://pypi.org/simple
|
||||||
|
|
||||||
# Set the working directory
|
# Set the working directory
|
||||||
|
@ -35,6 +36,13 @@ RUN EXTRA_PACKAGES="metrics"; \
|
||||||
pip install -e .[$EXTRA_PACKAGES] && \
|
pip install -e .[$EXTRA_PACKAGES] && \
|
||||||
pip uninstall -y transformer-engine flash-attn
|
pip uninstall -y transformer-engine flash-attn
|
||||||
|
|
||||||
|
# Rebuild flash-attn
|
||||||
|
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
|
# Set up volumes
|
||||||
VOLUME [ "/root/.cache/huggingface", "/root/.cache/modelscope", "/app/data", "/app/output" ]
|
VOLUME [ "/root/.cache/huggingface", "/root/.cache/modelscope", "/app/data", "/app/output" ]
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ services:
|
||||||
INSTALL_BNB: false
|
INSTALL_BNB: false
|
||||||
INSTALL_VLLM: false
|
INSTALL_VLLM: false
|
||||||
INSTALL_DEEPSPEED: false
|
INSTALL_DEEPSPEED: false
|
||||||
|
INSTALL_FLASH_ATTN: false
|
||||||
PIP_INDEX: https://pypi.org/simple
|
PIP_INDEX: https://pypi.org/simple
|
||||||
container_name: llamafactory
|
container_name: llamafactory
|
||||||
volumes:
|
volumes:
|
||||||
|
|
Loading…
Reference in New Issue