|
|
|
|
|
|
| FROM ascendai/cann:8.0.0-910b-ubuntu22.04-py3.10
|
|
|
|
|
|
|
|
|
| ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
| ARG INSTALL_DEEPSPEED=false
|
| ARG PIP_INDEX=https://pypi.org/simple
|
| ARG TORCH_INDEX=https://download.pytorch.org/whl/cpu
|
| ARG HTTP_PROXY=
|
|
|
|
|
| WORKDIR /app
|
|
|
|
|
| RUN if [ -n "$HTTP_PROXY" ]; then \
|
| echo "Configuring proxy..."; \
|
| export http_proxy=$HTTP_PROXY; \
|
| export https_proxy=$HTTP_PROXY; \
|
| fi
|
|
|
|
|
| COPY requirements.txt /app
|
| RUN pip config set global.index-url "$PIP_INDEX" && \
|
| pip config set global.extra-index-url "$TORCH_INDEX" && \
|
| python -m pip install --upgrade pip && \
|
| if [ -n "$HTTP_PROXY" ]; then \
|
| python -m pip install --proxy=$HTTP_PROXY -r requirements.txt; \
|
| else \
|
| python -m pip install -r requirements.txt; \
|
| fi
|
|
|
|
|
| COPY . /app
|
|
|
|
|
| RUN EXTRA_PACKAGES="torch-npu,metrics"; \
|
| if [ "$INSTALL_DEEPSPEED" == "true" ]; then \
|
| EXTRA_PACKAGES="${EXTRA_PACKAGES},deepspeed"; \
|
| fi; \
|
| if [ -n "$HTTP_PROXY" ]; then \
|
| pip install --proxy=$HTTP_PROXY -e ".[$EXTRA_PACKAGES]"; \
|
| else \
|
| pip install -e ".[$EXTRA_PACKAGES]"; \
|
| fi
|
|
|
|
|
| RUN if [ -n "$HTTP_PROXY" ]; then \
|
| unset http_proxy; \
|
| unset https_proxy; \
|
| fi
|
|
|
|
|
| VOLUME [ "/root/.cache/huggingface", "/root/.cache/modelscope", "/app/data", "/app/output" ]
|
|
|
|
|
| ENV GRADIO_SERVER_PORT 7860
|
| EXPOSE 7860
|
|
|
|
|
| ENV API_PORT 8000
|
| EXPOSE 8000
|
|
|