feat: Support llama.cpp

This commit is contained in:
FangYin Cheng
2023-08-15 18:58:15 +08:00
parent dbae09203f
commit b5fd5d2a3a
15 changed files with 652 additions and 73 deletions

View File

@@ -11,19 +11,30 @@ ARG LANGUAGE="en"
ARG PIP_INDEX_URL="https://pypi.org/simple"
ENV PIP_INDEX_URL=$PIP_INDEX_URL
RUN mkdir -p /app
# COPY only requirements.txt first to leverage Docker cache
COPY ./requirements.txt /tmp/requirements.txt
COPY ./requirements.txt /app/requirements.txt
COPY ./setup.py /app/setup.py
COPY ./README.md /app/README.md
WORKDIR /app
# RUN pip3 install --upgrade pip -i $PIP_INDEX_URL \
# && (if [ "${BUILD_LOCAL_CODE}" = "false" ]; \
# # if not build local code, clone latest code from git, and rename to /app, TODO: download by version, like: https://github.com/eosphoros-ai/DB-GPT/archive/refs/tags/$DBGPT_VERSION.zip
# then git clone https://github.com/eosphoros-ai/DB-GPT.git /app \
# && cp /app/requirements.txt /tmp/requirements.txt; \
# fi;) \
# && pip3 install -r /tmp/requirements.txt -i $PIP_INDEX_URL --no-cache-dir \
# && rm /tmp/requirements.txt
RUN pip3 install --upgrade pip -i $PIP_INDEX_URL \
&& (if [ "${BUILD_LOCAL_CODE}" = "false" ]; \
# if not build local code, clone latest code from git, and rename to /app, TODO: download by version, like: https://github.com/eosphoros-ai/DB-GPT/archive/refs/tags/$DBGPT_VERSION.zip
then git clone https://github.com/eosphoros-ai/DB-GPT.git /app \
&& cp /app/requirements.txt /tmp/requirements.txt; \
fi;) \
&& pip3 install -r /tmp/requirements.txt -i $PIP_INDEX_URL --no-cache-dir \
&& rm /tmp/requirements.txt
&& cd /app && pip3 install -i $PIP_INDEX_URL .
# ENV CMAKE_ARGS="-DLLAMA_CUBLAS=ON -DLLAMA_AVX2=OFF -DLLAMA_F16C=OFF -DLLAMA_FMA=OFF"
# ENV FORCE_CMAKE=1
RUN cd /app && pip3 install -i $PIP_INDEX_URL .[llama_cpp]
RUN (if [ "${LANGUAGE}" = "zh" ]; \
# language is zh, download zh_core_web_sm from github
@@ -37,12 +48,11 @@ RUN (if [ "${LANGUAGE}" = "zh" ]; \
ARG BUILD_LOCAL_CODE="false"
# COPY the rest of the app
COPY . /tmp/app
COPY . /app
# TODONeed to find a better way to determine whether to build docker image with local code.
RUN (if [ "${BUILD_LOCAL_CODE}" = "true" ]; \
then mv /tmp/app / && rm -rf /app/logs && rm -rf /app/pilot/data && rm -rf /app/pilot/message; \
else rm -rf /tmp/app; \
then rm -rf /app/logs && rm -rf /app/pilot/data && rm -rf /app/pilot/message; \
fi;)
ARG LOAD_EXAMPLES="true"