mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-10-14 23:58:11 +08:00
Update Dockerfile
Former-commit-id: 7dea6840256472f8aa2c642f11d9e30bfa0fb96f
This commit is contained in:
parent
f6eda1c35d
commit
88018000ac
@ -1,39 +1,38 @@
|
|||||||
# Use the Ubuntu 22.04 image with CANN 8.0.rc1
|
# Use the Ubuntu 22.04 image with CANN 8.0.rc1
|
||||||
# More versions can be found at https://hub.docker.com/r/cosdt/cann/tags
|
# More versions can be found at https://hub.docker.com/r/cosdt/cann/tags
|
||||||
FROM --platform=$TARGETPLATFORM cosdt/cann:8.0.rc1-910b-ubuntu22.04
|
FROM cosdt/cann:8.0.rc1-910b-ubuntu22.04
|
||||||
|
|
||||||
|
# Set env
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Define installation arguments
|
# Define installation arguments
|
||||||
ARG TARGETPLATFORM
|
|
||||||
ARG INSTALL_DEEPSPEED=false
|
ARG INSTALL_DEEPSPEED=false
|
||||||
ARG PIP_INDEX=https://pypi.org/simple
|
ARG PIP_INDEX=https://pypi.org/simple
|
||||||
ARG EXTRA_INDEX=https://download.pytorch.org/whl/cpu
|
# x86 torch cpu index
|
||||||
|
ARG TORCH_INDEX=https://download.pytorch.org/whl/cpu
|
||||||
|
|
||||||
# Set the working directory
|
# Set the working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install the requirements
|
# Install the requirements
|
||||||
COPY requirements.txt /app
|
COPY requirements.txt /app
|
||||||
RUN pip config set global.index-url $PIP_INDEX && \
|
RUN pip config set global.index-url "$PIP_INDEX" && \
|
||||||
pip install --upgrade pip && \
|
pip config set global.extra-index-url "$PIP_INDEX" && \
|
||||||
pip install -r requirements.txt
|
python -m pip install --upgrade pip && \
|
||||||
|
python -m pip install -r requirements.txt
|
||||||
|
|
||||||
# Copy the rest of the application into the image
|
# Copy the rest of the application into the image
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
# Install the LLaMA Factory
|
# Install the LLaMA Factory
|
||||||
RUN EXTRA_PACKAGES="metrics"; \
|
RUN EXTRA_PACKAGES="torch-npu,metrics"; \
|
||||||
if [ "$TARGETPLATFORM" == "linux/arm64" ]; then \
|
if [ "$INSTALL_DEEPSPEED" == "true" ]; then \
|
||||||
EXTRA_PACKAGES="${EXTRA_PACKAGES},torch-npu-arm64"; \
|
|
||||||
else \
|
|
||||||
pip config set global.extra-index-url $EXTRA_INDEX; \
|
|
||||||
EXTRA_PACKAGES="${EXTRA_PACKAGES},torch-npu-amd64"; \
|
|
||||||
fi; \
|
|
||||||
if [ "$INSTALL_DEEPSPEED" = "true" ]; then \
|
|
||||||
EXTRA_PACKAGES="${EXTRA_PACKAGES},deepspeed"; \
|
EXTRA_PACKAGES="${EXTRA_PACKAGES},deepspeed"; \
|
||||||
fi; \
|
fi; \
|
||||||
pip install -e .[$EXTRA_PACKAGES] && \
|
if [ "$(uname -i)" != "aarch64" ]; then \
|
||||||
|
pip config set global.extra-index-url "$TORCH_INDEX" \
|
||||||
|
fi; \
|
||||||
|
pip install -e ".[$EXTRA_PACKAGES]" && \
|
||||||
pip uninstall -y transformer-engine flash-attn
|
pip uninstall -y transformer-engine flash-attn
|
||||||
|
|
||||||
# Set up volumes
|
# Set up volumes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user