2024-06-24 16:50:34 +00:00
|
|
|
# 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
|
2024-06-24 10:57:36 +00:00
|
|
|
FROM cosdt/cann:8.0.rc1-910b-ubuntu22.04
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
# Define installation arguments
|
|
|
|
ARG INSTALL_DEEPSPEED=false
|
|
|
|
ARG PIP_INDEX=https://pypi.org/simple
|
|
|
|
|
|
|
|
# Set the working directory
|
2024-06-24 16:50:34 +00:00
|
|
|
WORKDIR /app
|
2024-06-24 10:57:36 +00:00
|
|
|
|
2024-06-24 16:50:34 +00:00
|
|
|
# Install the requirements
|
|
|
|
COPY requirements.txt /app
|
2024-06-24 10:57:36 +00:00
|
|
|
RUN pip config set global.index-url $PIP_INDEX
|
2024-06-24 16:50:34 +00:00
|
|
|
RUN pip config set global.extra-index-url $PIP_INDEX
|
|
|
|
RUN python -m pip install --upgrade pip
|
|
|
|
RUN python -m pip install -r requirements.txt
|
|
|
|
|
|
|
|
# Copy the rest of the application into the image
|
|
|
|
COPY . /app
|
2024-06-24 10:57:36 +00:00
|
|
|
|
|
|
|
# Install the LLaMA Factory
|
|
|
|
RUN EXTRA_PACKAGES="torch-npu,metrics"; \
|
|
|
|
if [ "$INSTALL_DEEPSPEED" = "true" ]; then \
|
|
|
|
EXTRA_PACKAGES="${EXTRA_PACKAGES},deepspeed"; \
|
|
|
|
fi; \
|
|
|
|
pip install -e .[$EXTRA_PACKAGES] && \
|
|
|
|
pip uninstall -y transformer-engine flash-attn
|
|
|
|
|
|
|
|
# Set up volumes
|
2024-06-24 17:51:29 +00:00
|
|
|
VOLUME [ "/root/.cache/huggingface", "/root/.cache/modelscope", "/app/data", "/app/output" ]
|
2024-06-24 10:57:36 +00:00
|
|
|
|
|
|
|
# Expose port 7860 for the LLaMA Board
|
2024-06-24 16:50:34 +00:00
|
|
|
ENV GRADIO_SERVER_PORT 7860
|
2024-06-24 10:57:36 +00:00
|
|
|
EXPOSE 7860
|
|
|
|
|
|
|
|
# Expose port 8000 for the API service
|
2024-06-24 16:50:34 +00:00
|
|
|
ENV API_PORT 8000
|
2024-06-24 10:57:36 +00:00
|
|
|
EXPOSE 8000
|