mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-05 02:20:08 +00:00
Merge remote-tracking branch 'origin/main' into feat_llm_manage
This commit is contained in:
commit
7c879e64ea
10
.github/release-drafter.yml
vendored
10
.github/release-drafter.yml
vendored
@ -76,6 +76,16 @@ autolabeler:
|
|||||||
# feat(connection): Support xxxx
|
# feat(connection): Support xxxx
|
||||||
# fix(connection): Fix xxx
|
# fix(connection): Fix xxx
|
||||||
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*connection.*\)/'
|
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*connection.*\)/'
|
||||||
|
- label: core
|
||||||
|
title:
|
||||||
|
# feat(core): Support xxxx
|
||||||
|
# fix(core): Fix xxx
|
||||||
|
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*core.*\)/'
|
||||||
|
- label: web
|
||||||
|
title:
|
||||||
|
# feat(web): Support xxxx
|
||||||
|
# fix(web): Fix xxx
|
||||||
|
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*web.*\)/'
|
||||||
- label: build
|
- label: build
|
||||||
title:
|
title:
|
||||||
- '/^build/'
|
- '/^build/'
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -28,6 +28,8 @@ sdist/
|
|||||||
var/
|
var/
|
||||||
wheels/
|
wheels/
|
||||||
models/
|
models/
|
||||||
|
# Soft link
|
||||||
|
models
|
||||||
plugins/
|
plugins/
|
||||||
|
|
||||||
pip-wheel-metadata/
|
pip-wheel-metadata/
|
||||||
|
@ -86,7 +86,7 @@ Currently, we have released multiple key features, which are listed below to dem
|
|||||||
- Unified vector storage/indexing of knowledge base
|
- Unified vector storage/indexing of knowledge base
|
||||||
- Support for unstructured data such as PDF, TXT, Markdown, CSV, DOC, PPT, and WebURL
|
- Support for unstructured data such as PDF, TXT, Markdown, CSV, DOC, PPT, and WebURL
|
||||||
- Multi LLMs Support, Supports multiple large language models, currently supporting
|
- Multi LLMs Support, Supports multiple large language models, currently supporting
|
||||||
- 🔥 InternLM(7b)
|
- 🔥 InternLM(7b,20b)
|
||||||
- 🔥 Baichuan2(7b,13b)
|
- 🔥 Baichuan2(7b,13b)
|
||||||
- 🔥 Vicuna-v1.5(7b,13b)
|
- 🔥 Vicuna-v1.5(7b,13b)
|
||||||
- 🔥 llama-2(7b,13b,70b)
|
- 🔥 llama-2(7b,13b,70b)
|
||||||
|
@ -119,7 +119,7 @@ DB-GPT 是一个开源的以数据库为基础的GPT实验项目,使用本地
|
|||||||
- 非结构化数据支持包括PDF、MarkDown、CSV、WebURL
|
- 非结构化数据支持包括PDF、MarkDown、CSV、WebURL
|
||||||
- 多模型支持
|
- 多模型支持
|
||||||
- 支持多种大语言模型, 当前已支持如下模型:
|
- 支持多种大语言模型, 当前已支持如下模型:
|
||||||
- 🔥 InternLM(7b)
|
- 🔥 InternLM(7b,20b)
|
||||||
- 🔥 Baichuan2(7b,13b)
|
- 🔥 Baichuan2(7b,13b)
|
||||||
- 🔥 Vicuna-v1.5(7b,13b)
|
- 🔥 Vicuna-v1.5(7b,13b)
|
||||||
- 🔥 llama-2(7b,13b,70b)
|
- 🔥 llama-2(7b,13b,70b)
|
||||||
|
@ -11,10 +11,12 @@ ARG LANGUAGE="en"
|
|||||||
ARG PIP_INDEX_URL="https://pypi.org/simple"
|
ARG PIP_INDEX_URL="https://pypi.org/simple"
|
||||||
ENV PIP_INDEX_URL=$PIP_INDEX_URL
|
ENV PIP_INDEX_URL=$PIP_INDEX_URL
|
||||||
|
|
||||||
|
ARG DB_GPT_INSTALL_MODEL="default"
|
||||||
|
ENV DB_GPT_INSTALL_MODEL=$DB_GPT_INSTALL_MODEL
|
||||||
|
|
||||||
RUN mkdir -p /app
|
RUN mkdir -p /app
|
||||||
|
|
||||||
# COPY only requirements.txt first to leverage Docker cache
|
# COPY only requirements.txt first to leverage Docker cache
|
||||||
COPY ./requirements.txt /app/requirements.txt
|
|
||||||
COPY ./setup.py /app/setup.py
|
COPY ./setup.py /app/setup.py
|
||||||
COPY ./README.md /app/README.md
|
COPY ./README.md /app/README.md
|
||||||
|
|
||||||
@ -26,9 +28,9 @@ WORKDIR /app
|
|||||||
# RUN pip3 install -i $PIP_INDEX_URL ".[all]"
|
# RUN pip3 install -i $PIP_INDEX_URL ".[all]"
|
||||||
|
|
||||||
RUN pip3 install --upgrade pip -i $PIP_INDEX_URL \
|
RUN pip3 install --upgrade pip -i $PIP_INDEX_URL \
|
||||||
&& pip3 install -i $PIP_INDEX_URL . \
|
&& pip3 install -i $PIP_INDEX_URL ".[$DB_GPT_INSTALL_MODEL]"
|
||||||
# && pip3 install -i $PIP_INDEX_URL ".[llama_cpp]" \
|
|
||||||
&& (if [ "${LANGUAGE}" = "zh" ]; \
|
RUN (if [ "${LANGUAGE}" = "zh" ]; \
|
||||||
# language is zh, download zh_core_web_sm from github
|
# language is zh, download zh_core_web_sm from github
|
||||||
then wget https://github.com/explosion/spacy-models/releases/download/zh_core_web_sm-3.5.0/zh_core_web_sm-3.5.0-py3-none-any.whl -O /tmp/zh_core_web_sm-3.5.0-py3-none-any.whl \
|
then wget https://github.com/explosion/spacy-models/releases/download/zh_core_web_sm-3.5.0/zh_core_web_sm-3.5.0-py3-none-any.whl -O /tmp/zh_core_web_sm-3.5.0-py3-none-any.whl \
|
||||||
&& pip3 install /tmp/zh_core_web_sm-3.5.0-py3-none-any.whl -i $PIP_INDEX_URL \
|
&& pip3 install /tmp/zh_core_web_sm-3.5.0-py3-none-any.whl -i $PIP_INDEX_URL \
|
||||||
@ -58,4 +60,4 @@ RUN (if [ "${LOAD_EXAMPLES}" = "true" ]; \
|
|||||||
ENV PYTHONPATH "/app:$PYTHONPATH"
|
ENV PYTHONPATH "/app:$PYTHONPATH"
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
CMD ["python3", "pilot/server/dbgpt_server.py"]
|
CMD ["dbgpt", "start", "webserver"]
|
@ -4,14 +4,21 @@ SCRIPT_LOCATION=$0
|
|||||||
cd "$(dirname "$SCRIPT_LOCATION")"
|
cd "$(dirname "$SCRIPT_LOCATION")"
|
||||||
WORK_DIR=$(pwd)
|
WORK_DIR=$(pwd)
|
||||||
|
|
||||||
BASE_IMAGE="nvidia/cuda:11.8.0-runtime-ubuntu22.04"
|
BASE_IMAGE_DEFAULT="nvidia/cuda:11.8.0-runtime-ubuntu22.04"
|
||||||
|
BASE_IMAGE_DEFAULT_CPU="ubuntu:22.04"
|
||||||
|
|
||||||
|
BASE_IMAGE=$BASE_IMAGE_DEFAULT
|
||||||
IMAGE_NAME="eosphorosai/dbgpt"
|
IMAGE_NAME="eosphorosai/dbgpt"
|
||||||
|
IMAGE_NAME_ARGS=""
|
||||||
|
|
||||||
# zh: https://pypi.tuna.tsinghua.edu.cn/simple
|
# zh: https://pypi.tuna.tsinghua.edu.cn/simple
|
||||||
PIP_INDEX_URL="https://pypi.org/simple"
|
PIP_INDEX_URL="https://pypi.org/simple"
|
||||||
# en or zh
|
# en or zh
|
||||||
LANGUAGE="en"
|
LANGUAGE="en"
|
||||||
BUILD_LOCAL_CODE="false"
|
BUILD_LOCAL_CODE="false"
|
||||||
LOAD_EXAMPLES="true"
|
LOAD_EXAMPLES="true"
|
||||||
|
BUILD_NETWORK=""
|
||||||
|
DB_GPT_INSTALL_MODEL="default"
|
||||||
|
|
||||||
usage () {
|
usage () {
|
||||||
echo "USAGE: $0 [--base-image nvidia/cuda:11.8.0-runtime-ubuntu22.04] [--image-name db-gpt]"
|
echo "USAGE: $0 [--base-image nvidia/cuda:11.8.0-runtime-ubuntu22.04] [--image-name db-gpt]"
|
||||||
@ -21,6 +28,8 @@ usage () {
|
|||||||
echo " [--language en or zh] You language, default: en"
|
echo " [--language en or zh] You language, default: en"
|
||||||
echo " [--build-local-code true or false] Whether to use the local project code to package the image, default: false"
|
echo " [--build-local-code true or false] Whether to use the local project code to package the image, default: false"
|
||||||
echo " [--load-examples true or false] Whether to load examples to default database default: true"
|
echo " [--load-examples true or false] Whether to load examples to default database default: true"
|
||||||
|
echo " [--network network name] The network of docker build"
|
||||||
|
echo " [--install-mode mode name] Installation mode name, default: default, If you completely use openai's service, you can set the mode name to 'openai'"
|
||||||
echo " [-h|--help] Usage message"
|
echo " [-h|--help] Usage message"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +42,7 @@ while [[ $# -gt 0 ]]; do
|
|||||||
shift # past value
|
shift # past value
|
||||||
;;
|
;;
|
||||||
-n|--image-name)
|
-n|--image-name)
|
||||||
IMAGE_NAME="$2"
|
IMAGE_NAME_ARGS="$2"
|
||||||
shift # past argument
|
shift # past argument
|
||||||
shift # past value
|
shift # past value
|
||||||
;;
|
;;
|
||||||
@ -57,6 +66,20 @@ while [[ $# -gt 0 ]]; do
|
|||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--network)
|
||||||
|
BUILD_NETWORK=" --network $2 "
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
help="true"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--install-mode)
|
||||||
|
DB_GPT_INSTALL_MODEL="$2"
|
||||||
|
shift # past argument
|
||||||
|
shift # past value
|
||||||
|
;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
help="true"
|
help="true"
|
||||||
shift
|
shift
|
||||||
@ -73,11 +96,29 @@ if [[ $help ]]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker build \
|
if [ "$DB_GPT_INSTALL_MODEL" != "default" ]; then
|
||||||
|
IMAGE_NAME="$IMAGE_NAME-$DB_GPT_INSTALL_MODEL"
|
||||||
|
echo "install mode is not 'default', set image name to: ${IMAGE_NAME}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$IMAGE_NAME_ARGS" ]; then
|
||||||
|
if [ "$DB_GPT_INSTALL_MODEL" == "openai" ]; then
|
||||||
|
# Use cpu image
|
||||||
|
BASE_IMAGE=$BASE_IMAGE_DEFAULT_CPU
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# User input image is not empty
|
||||||
|
BASE_IMAGE=$IMAGE_NAME_ARGS
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Begin build docker image, base image: ${BASE_IMAGE}, target image name: ${IMAGE_NAME}"
|
||||||
|
|
||||||
|
docker build $BUILD_NETWORK \
|
||||||
--build-arg BASE_IMAGE=$BASE_IMAGE \
|
--build-arg BASE_IMAGE=$BASE_IMAGE \
|
||||||
--build-arg PIP_INDEX_URL=$PIP_INDEX_URL \
|
--build-arg PIP_INDEX_URL=$PIP_INDEX_URL \
|
||||||
--build-arg LANGUAGE=$LANGUAGE \
|
--build-arg LANGUAGE=$LANGUAGE \
|
||||||
--build-arg BUILD_LOCAL_CODE=$BUILD_LOCAL_CODE \
|
--build-arg BUILD_LOCAL_CODE=$BUILD_LOCAL_CODE \
|
||||||
--build-arg LOAD_EXAMPLES=$LOAD_EXAMPLES \
|
--build-arg LOAD_EXAMPLES=$LOAD_EXAMPLES \
|
||||||
|
--build-arg DB_GPT_INSTALL_MODEL=$DB_GPT_INSTALL_MODEL \
|
||||||
-f Dockerfile \
|
-f Dockerfile \
|
||||||
-t $IMAGE_NAME $WORK_DIR/../../
|
-t $IMAGE_NAME $WORK_DIR/../../
|
||||||
|
@ -6,7 +6,7 @@ Local cluster deployment
|
|||||||
|
|
||||||
**Installing Command-Line Tool**
|
**Installing Command-Line Tool**
|
||||||
|
|
||||||
All operations below are performed using the `dbgpt` command. To use the `dbgpt` command, you need to install the DB-GPT project with `pip install -e .`. Alternatively, you can use `python pilot/scripts/cli_scripts.py` as a substitute for the `dbgpt` command.
|
All operations below are performed using the `dbgpt` command. To use the `dbgpt` command, you need to install the DB-GPT project with `pip install -e ".[default]"`. Alternatively, you can use `python pilot/scripts/cli_scripts.py` as a substitute for the `dbgpt` command.
|
||||||
|
|
||||||
### Launch Model Controller
|
### Launch Model Controller
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ For the entire installation process of DB-GPT, we use the miniconda3 virtual env
|
|||||||
python>=3.10
|
python>=3.10
|
||||||
conda create -n dbgpt_env python=3.10
|
conda create -n dbgpt_env python=3.10
|
||||||
conda activate dbgpt_env
|
conda activate dbgpt_env
|
||||||
pip install -e .
|
pip install -e ".[default]"
|
||||||
```
|
```
|
||||||
Before use DB-GPT Knowledge
|
Before use DB-GPT Knowledge
|
||||||
```bash
|
```bash
|
||||||
|
@ -6,7 +6,7 @@ DB-GPT provides a management and deployment solution for multiple models. This c
|
|||||||
|
|
||||||
|
|
||||||
Multi LLMs Support, Supports multiple large language models, currently supporting
|
Multi LLMs Support, Supports multiple large language models, currently supporting
|
||||||
- 🔥 InternLM(7b)
|
- 🔥 InternLM(7b,20b)
|
||||||
- 🔥 Baichuan2(7b,13b)
|
- 🔥 Baichuan2(7b,13b)
|
||||||
- 🔥 Vicuna-v1.5(7b,13b)
|
- 🔥 Vicuna-v1.5(7b,13b)
|
||||||
- 🔥 llama-2(7b,13b,70b)
|
- 🔥 llama-2(7b,13b,70b)
|
||||||
|
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: DB-GPT 👏👏 0.3.6\n"
|
"Project-Id-Version: DB-GPT 👏👏 0.3.6\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2023-09-13 09:06+0800\n"
|
"POT-Creation-Date: 2023-09-20 17:34+0800\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language: zh_CN\n"
|
"Language: zh_CN\n"
|
||||||
@ -20,157 +20,156 @@ msgstr ""
|
|||||||
"Generated-By: Babel 2.12.1\n"
|
"Generated-By: Babel 2.12.1\n"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:1
|
#: ../../getting_started/install/cluster/vms/index.md:1
|
||||||
#: 2d2e04ba49364eae9b8493bb274765a6
|
#: 48c062c146cd42b48c248ae590d386df
|
||||||
msgid "Local cluster deployment"
|
msgid "Local cluster deployment"
|
||||||
msgstr "本地集群部署"
|
msgstr "本地集群部署"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:4
|
#: ../../getting_started/install/cluster/vms/index.md:4
|
||||||
#: e405d0e7ad8c4b2da4b4ca27c77f5fea
|
#: ce59bbbc9c294cafa6df8165de61967f
|
||||||
msgid "Model cluster deployment"
|
msgid "Model cluster deployment"
|
||||||
msgstr "模型集群部署"
|
msgstr "模型集群部署"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:7
|
#: ../../getting_started/install/cluster/vms/index.md:7
|
||||||
#: bba397ddac754a2bab8edca163875b65
|
#: 51650b41f4974f819a623db1e97764c7
|
||||||
msgid "**Installing Command-Line Tool**"
|
msgid "**Installing Command-Line Tool**"
|
||||||
msgstr "**安装命令行工具**"
|
msgstr "**安装命令行工具**"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:9
|
#: ../../getting_started/install/cluster/vms/index.md:9
|
||||||
#: bc45851124354522af8c9bb9748ff1fa
|
#: 64fcb0e3ec8d491aa9d15f783823e579
|
||||||
|
#, fuzzy
|
||||||
msgid ""
|
msgid ""
|
||||||
"All operations below are performed using the `dbgpt` command. To use the "
|
"All operations below are performed using the `dbgpt` command. To use the "
|
||||||
"`dbgpt` command, you need to install the DB-GPT project with `pip install"
|
"`dbgpt` command, you need to install the DB-GPT project with `pip install"
|
||||||
" -e .`. Alternatively, you can use `python pilot/scripts/cli_scripts.py` "
|
" -e \".[default]\"`. Alternatively, you can use `python "
|
||||||
"as a substitute for the `dbgpt` command."
|
"pilot/scripts/cli_scripts.py` as a substitute for the `dbgpt` command."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"以下所有操作都使用 `dbgpt` 命令完成。要使用 `dbgpt` 命令,您需要安装DB-GPT项目,方法是使用`pip install -e .`。或者,您可以使用 `python pilot/scripts/cli_scripts.py` 作为 `dbgpt` 命令的替代。"
|
"以下所有操作都使用 `dbgpt` 命令完成。要使用 `dbgpt` 命令,您需要安装DB-GPT项目,方法是使用`pip install -e "
|
||||||
|
".`。或者,您可以使用 `python pilot/scripts/cli_scripts.py` 作为 `dbgpt` 命令的替代。"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:11
|
#: ../../getting_started/install/cluster/vms/index.md:11
|
||||||
#: 9d11f7807fd140c8949b634700adc966
|
#: 572f2d79178a4e6780799dd8bc0867f9
|
||||||
msgid "Launch Model Controller"
|
msgid "Launch Model Controller"
|
||||||
msgstr "启动 Model Controller"
|
msgstr "启动 Model Controller"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:17
|
#: ../../getting_started/install/cluster/vms/index.md:17
|
||||||
#: 97716be92ba64ce9a215433bddf77add
|
#: 66cfeb3d834c4f7b87bb3180ae447203
|
||||||
msgid "By default, the Model Controller starts on port 8000."
|
msgid "By default, the Model Controller starts on port 8000."
|
||||||
msgstr "默认情况下,Model Controller 启动在 8000 端口。"
|
msgstr "默认情况下,Model Controller 启动在 8000 端口。"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:20
|
#: ../../getting_started/install/cluster/vms/index.md:20
|
||||||
#: 3f65e6a1e59248a59c033891d1ab7ba8
|
#: cddb3dbc31734462b6aa3c63e3c76fe2
|
||||||
msgid "Launch LLM Model Worker"
|
msgid "Launch LLM Model Worker"
|
||||||
msgstr "启动 LLM Model Worker"
|
msgstr "启动 LLM Model Worker"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:22
|
#: ../../getting_started/install/cluster/vms/index.md:22
|
||||||
#: 60241d97573e4265b7fb150c378c4a08
|
#: 953eeafd791942e895833bce2a4d755f
|
||||||
msgid "If you are starting `chatglm2-6b`:"
|
msgid "If you are starting `chatglm2-6b`:"
|
||||||
msgstr "如果您启动的是 `chatglm2-6b`:"
|
msgstr "如果您启动的是 `chatglm2-6b`:"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:31
|
#: ../../getting_started/install/cluster/vms/index.md:31
|
||||||
#: 18bbeb1de110438fa96dd5c736b9a7b1
|
#: 779d8daa394b4731bc74a93c077961e1
|
||||||
msgid "If you are starting `vicuna-13b-v1.5`:"
|
msgid "If you are starting `vicuna-13b-v1.5`:"
|
||||||
msgstr "如果您启动的是 `vicuna-13b-v1.5`:"
|
msgstr "如果您启动的是 `vicuna-13b-v1.5`:"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:40
|
#: ../../getting_started/install/cluster/vms/index.md:40
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:53
|
#: ../../getting_started/install/cluster/vms/index.md:53
|
||||||
#: 24b1a27313c64224aaeab6cbfad1fe19 fc94a698a7904c6893eef7e7a6e52972
|
#: 736b34df46e640fbbf3eb41ff5f44cc2 b620ee13d10748e6a89c67a9bfb5a53b
|
||||||
msgid "Note: Be sure to use your own model name and model path."
|
msgid "Note: Be sure to use your own model name and model path."
|
||||||
msgstr "注意:确保使用您自己的模型名称和模型路径。"
|
msgstr "注意:确保使用您自己的模型名称和模型路径。"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:42
|
#: ../../getting_started/install/cluster/vms/index.md:42
|
||||||
#: 19746195e85f4784bf66a9e67378c04b
|
#: d1f48ab4090d4344aa2a010cdc88a28e
|
||||||
msgid "Launch Embedding Model Worker"
|
msgid "Launch Embedding Model Worker"
|
||||||
msgstr "启动 Embedding Model Worker"
|
msgstr "启动 Embedding Model Worker"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:55
|
#: ../../getting_started/install/cluster/vms/index.md:55
|
||||||
#: e93ce68091f64d0294b3f912a66cc18b
|
#: 0b4c6d2ff51c4167b553a6255ce268ba
|
||||||
msgid "Check your model:"
|
msgid "Check your model:"
|
||||||
msgstr "检查您的模型:"
|
msgstr "检查您的模型:"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:61
|
#: ../../getting_started/install/cluster/vms/index.md:61
|
||||||
#: fa0b8f3a18fe4bab88fbf002bf26d32e
|
#: defd23cef23a4e74b150b7b49b99d333
|
||||||
msgid "You will see the following output:"
|
msgid "You will see the following output:"
|
||||||
msgstr "您将看到以下输出:"
|
msgstr "您将看到以下输出:"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:75
|
#: ../../getting_started/install/cluster/vms/index.md:75
|
||||||
#: 695262fb4f224101902bc7865ac7871f
|
#: aaa86e08b60e46ddae52a03f25812f24
|
||||||
msgid "Connect to the model service in the webserver (dbgpt_server)"
|
msgid "Connect to the model service in the webserver (dbgpt_server)"
|
||||||
msgstr "在 webserver (dbgpt_server) 中连接到模型服务 (dbgpt_server)"
|
msgstr "在 webserver (dbgpt_server) 中连接到模型服务 (dbgpt_server)"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:77
|
#: ../../getting_started/install/cluster/vms/index.md:77
|
||||||
#: 73bf4c2ae5c64d938e3b7e77c06fa21e
|
#: 7fd7b622b2f649d0b7d9b51a998a038c
|
||||||
msgid ""
|
msgid ""
|
||||||
"**First, modify the `.env` file to change the model name and the Model "
|
"**First, modify the `.env` file to change the model name and the Model "
|
||||||
"Controller connection address.**"
|
"Controller connection address.**"
|
||||||
msgstr ""
|
msgstr "**首先,修改 `.env` 文件以更改模型名称和模型控制器连接地址。**"
|
||||||
"**首先,修改 `.env` 文件以更改模型名称和模型控制器连接地址。**"
|
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:85
|
#: ../../getting_started/install/cluster/vms/index.md:85
|
||||||
#: 8ab126fd72ed4368a79b821ba50e62c8
|
#: 7ce03ec66f624d0eabd5a2fbe2efcbcc
|
||||||
msgid "Start the webserver"
|
msgid "Start the webserver"
|
||||||
msgstr "启动 webserver"
|
msgstr "启动 webserver"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:91
|
#: ../../getting_started/install/cluster/vms/index.md:91
|
||||||
#: 5a7e25c84ca2412bb64310bfad9e2403
|
#: 9e1e2b7925834d6b9140633db1082032
|
||||||
msgid "`--light` indicates not to start the embedded model service."
|
msgid "`--light` indicates not to start the embedded model service."
|
||||||
msgstr "`--light` 表示不启动嵌入式模型服务。"
|
msgstr "`--light` 表示不启动嵌入式模型服务。"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:93
|
#: ../../getting_started/install/cluster/vms/index.md:93
|
||||||
#: 8cd9ec4fa9cb4c0fa8ff05c05a85ea7f
|
#: 4d47f76763914a78a89d62f0befa3fd9
|
||||||
msgid ""
|
msgid ""
|
||||||
"Alternatively, you can prepend the command with `LLM_MODEL=chatglm2-6b` "
|
"Alternatively, you can prepend the command with `LLM_MODEL=chatglm2-6b` "
|
||||||
"to start:"
|
"to start:"
|
||||||
msgstr ""
|
msgstr "或者,您可以在命令前加上 `LLM_MODEL=chatglm2-6b` 来启动:"
|
||||||
"或者,您可以在命令前加上 `LLM_MODEL=chatglm2-6b` 来启动:"
|
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:100
|
#: ../../getting_started/install/cluster/vms/index.md:100
|
||||||
#: 13ed16758a104860b5fc982d36638b17
|
#: 28408fe554dd411c9ca672466d5563b6
|
||||||
msgid "More Command-Line Usages"
|
msgid "More Command-Line Usages"
|
||||||
msgstr "更多命令行用法"
|
msgstr "更多命令行用法"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:102
|
#: ../../getting_started/install/cluster/vms/index.md:102
|
||||||
#: 175f614d547a4391bab9a77762f9174e
|
#: 8e0aa88d092d49fdb0fa849c83565a41
|
||||||
msgid "You can view more command-line usages through the help command."
|
msgid "You can view more command-line usages through the help command."
|
||||||
msgstr "您可以通过帮助命令查看更多命令行用法。"
|
msgstr "您可以通过帮助命令查看更多命令行用法。"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:104
|
#: ../../getting_started/install/cluster/vms/index.md:104
|
||||||
#: 6a4475d271c347fbbb35f2936a86823f
|
#: f307f82ced7947f980bb65b3543580d1
|
||||||
msgid "**View the `dbgpt` help**"
|
msgid "**View the `dbgpt` help**"
|
||||||
msgstr "**查看 `dbgpt` 帮助**"
|
msgstr "**查看 `dbgpt` 帮助**"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:109
|
#: ../../getting_started/install/cluster/vms/index.md:109
|
||||||
#: 3eb11234cf504cc9ac369d8462daa14b
|
#: 7564aed77a7d43e6878b506c6a9788a2
|
||||||
msgid "You will see the basic command parameters and usage:"
|
msgid "You will see the basic command parameters and usage:"
|
||||||
msgstr "您将看到基本的命令参数和用法:"
|
msgstr "您将看到基本的命令参数和用法:"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:127
|
#: ../../getting_started/install/cluster/vms/index.md:127
|
||||||
#: 6eb47aecceec414e8510fe022b6fddbd
|
#: 569f2b9e62e44179ae8dcf5b05a1f3e8
|
||||||
msgid "**View the `dbgpt start` help**"
|
msgid "**View the `dbgpt start` help**"
|
||||||
msgstr "**查看 `dbgpt start` 帮助**"
|
msgstr "**查看 `dbgpt start` 帮助**"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:133
|
#: ../../getting_started/install/cluster/vms/index.md:133
|
||||||
#: 1f4c0a4ce0704ca8ac33178bd13c69ad
|
#: 43e8747d136d4f6cab83c1b1beaa32b0
|
||||||
msgid "Here you can see the related commands and usage for start:"
|
msgid "Here you can see the related commands and usage for start:"
|
||||||
msgstr "在这里,您可以看到启动的相关命令和用法:"
|
msgstr "在这里,您可以看到启动的相关命令和用法:"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:150
|
#: ../../getting_started/install/cluster/vms/index.md:150
|
||||||
#: 22e8e67bc55244e79764d091f334560b
|
#: 25e37b3050b348ec9a5c96d9db515e9b
|
||||||
msgid "**View the `dbgpt start worker`help**"
|
msgid "**View the `dbgpt start worker`help**"
|
||||||
msgstr "**查看 `dbgpt start worker` 帮助**"
|
msgstr "**查看 `dbgpt start worker` 帮助**"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:156
|
#: ../../getting_started/install/cluster/vms/index.md:156
|
||||||
#: 5631b83fda714780855e99e90d4eb542
|
#: 8e959fd455ca45f9a5e69e0af9b764a4
|
||||||
msgid "Here you can see the parameters to start Model Worker:"
|
msgid "Here you can see the parameters to start Model Worker:"
|
||||||
msgstr "在这里,您可以看到启动 Model Worker 的参数:"
|
msgstr "在这里,您可以看到启动 Model Worker 的参数:"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:215
|
#: ../../getting_started/install/cluster/vms/index.md:215
|
||||||
#: cf4a31fd3368481cba1b3ab382615f53
|
#: 374d274c7a254533900145ef17bb24fb
|
||||||
msgid "**View the `dbgpt model`help**"
|
msgid "**View the `dbgpt model`help**"
|
||||||
msgstr "**查看 `dbgpt model` 帮助**"
|
msgstr "**查看 `dbgpt model` 帮助**"
|
||||||
|
|
||||||
#: ../../getting_started/install/cluster/vms/index.md:221
|
#: ../../getting_started/install/cluster/vms/index.md:221
|
||||||
#: 3740774ec4b240f2882b5b59da224d55
|
#: 19bcc9abe62f490d9c3c092c5deea24a
|
||||||
msgid ""
|
msgid ""
|
||||||
"The `dbgpt model ` command can connect to the Model Controller via the "
|
"The `dbgpt model ` command can connect to the Model Controller via the "
|
||||||
"Model Controller address and then manage a remote model:"
|
"Model Controller address and then manage a remote model:"
|
||||||
msgstr ""
|
msgstr "`dbgpt model` 命令可以通过 Model Controller 地址连接到 Model Controller,然后管理远程模型:"
|
||||||
"`dbgpt model` 命令可以通过 Model Controller 地址连接到 Model Controller,然后管理远程模型:"
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: DB-GPT 👏👏 0.3.5\n"
|
"Project-Id-Version: DB-GPT 👏👏 0.3.5\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2023-09-13 10:46+0800\n"
|
"POT-Creation-Date: 2023-09-20 17:34+0800\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language: zh_CN\n"
|
"Language: zh_CN\n"
|
||||||
@ -20,86 +20,91 @@ msgstr ""
|
|||||||
"Generated-By: Babel 2.12.1\n"
|
"Generated-By: Babel 2.12.1\n"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:2
|
#: ../../getting_started/install/llm/llm.rst:2
|
||||||
#: ../../getting_started/install/llm/llm.rst:24
|
#: ../../getting_started/install/llm/llm.rst:25
|
||||||
#: e693a8d3769b4d9e99c4442ca77dc43c
|
#: 5242ca319fab49988e018cd5b5d893df
|
||||||
msgid "LLM Usage"
|
msgid "LLM Usage"
|
||||||
msgstr "LLM使用"
|
msgstr "LLM使用"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:3 0a73562d18ba455bab04277b715c3840
|
#: ../../getting_started/install/llm/llm.rst:3 b12a86c062f441cd870e94d56146e6ea
|
||||||
msgid ""
|
msgid ""
|
||||||
"DB-GPT provides a management and deployment solution for multiple models."
|
"DB-GPT provides a management and deployment solution for multiple models."
|
||||||
" This chapter mainly discusses how to deploy different models."
|
" This chapter mainly discusses how to deploy different models."
|
||||||
msgstr "DB-GPT提供了多模型的管理和部署方案,本章主要讲解针对不同的模型该怎么部署"
|
msgstr "DB-GPT提供了多模型的管理和部署方案,本章主要讲解针对不同的模型该怎么部署"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:19
|
#: ../../getting_started/install/llm/llm.rst:20
|
||||||
#: d7e4de2a7e004888897204ec76b6030b
|
#: a7e76642fec94a658a48ced7b4133a61
|
||||||
msgid ""
|
msgid ""
|
||||||
"Multi LLMs Support, Supports multiple large language models, currently "
|
"Multi LLMs Support, Supports multiple large language models, currently "
|
||||||
"supporting"
|
"supporting"
|
||||||
msgstr "目前DB-GPT已适配如下模型"
|
msgstr "目前DB-GPT已适配如下模型"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:9 4616886b8b2244bd93355e871356d89e
|
#: ../../getting_started/install/llm/llm.rst:9 9dbc17aae88a4d2fa4c291d58e8390e2
|
||||||
|
msgid "🔥 InternLM(7b,20b)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../../getting_started/install/llm/llm.rst:10
|
||||||
|
#: 7d423bfe0c9f41758f0bf55e30803955
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "🔥 Baichuan2(7b,13b)"
|
msgid "🔥 Baichuan2(7b,13b)"
|
||||||
msgstr "Baichuan(7b,13b)"
|
msgstr "Baichuan(7b,13b)"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:10
|
#: ../../getting_started/install/llm/llm.rst:11
|
||||||
#: ad0e4793d4e744c1bdf59f5a3d9c84be
|
#: 2e44b9f9f2a842d1969255610974f9c0
|
||||||
msgid "🔥 Vicuna-v1.5(7b,13b)"
|
msgid "🔥 Vicuna-v1.5(7b,13b)"
|
||||||
msgstr "🔥 Vicuna-v1.5(7b,13b)"
|
msgstr "🔥 Vicuna-v1.5(7b,13b)"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:11
|
#: ../../getting_started/install/llm/llm.rst:12
|
||||||
#: d291e58001ae487bbbf2a1f9f889f5fd
|
#: ea32bf9802054af396accaf55291a3a1
|
||||||
msgid "🔥 llama-2(7b,13b,70b)"
|
msgid "🔥 llama-2(7b,13b,70b)"
|
||||||
msgstr "🔥 llama-2(7b,13b,70b)"
|
msgstr "🔥 llama-2(7b,13b,70b)"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:12
|
#: ../../getting_started/install/llm/llm.rst:13
|
||||||
#: 1e49702ee40b4655945a2a13efaad536
|
#: fc39e32250424dbaa7c0c65d45a01983
|
||||||
msgid "WizardLM-v1.2(13b)"
|
msgid "WizardLM-v1.2(13b)"
|
||||||
msgstr "WizardLM-v1.2(13b)"
|
msgstr "WizardLM-v1.2(13b)"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:13
|
#: ../../getting_started/install/llm/llm.rst:14
|
||||||
#: 4ef5913ddfe840d7a12289e6e1d4cb60
|
#: e17ed83eba5a46ea9950c8ba719403ba
|
||||||
msgid "Vicuna (7b,13b)"
|
msgid "Vicuna (7b,13b)"
|
||||||
msgstr "Vicuna (7b,13b)"
|
msgstr "Vicuna (7b,13b)"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:14
|
#: ../../getting_started/install/llm/llm.rst:15
|
||||||
#: ea46c2211257459285fa48083cb59561
|
#: a13575c9b1b1458282d5a6351128735f
|
||||||
msgid "ChatGLM-6b (int4,int8)"
|
msgid "ChatGLM-6b (int4,int8)"
|
||||||
msgstr "ChatGLM-6b (int4,int8)"
|
msgstr "ChatGLM-6b (int4,int8)"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:15
|
#: ../../getting_started/install/llm/llm.rst:16
|
||||||
#: 90688302bae4452a84f14e8ecb7f1a21
|
#: 504b4a29240d4e69a258d5ca4d0846d2
|
||||||
msgid "ChatGLM2-6b (int4,int8)"
|
msgid "ChatGLM2-6b (int4,int8)"
|
||||||
msgstr "ChatGLM2-6b (int4,int8)"
|
msgstr "ChatGLM2-6b (int4,int8)"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:16
|
#: ../../getting_started/install/llm/llm.rst:17
|
||||||
#: ee1469545a314696a36e7296c7b71960
|
#: 0edd5c73197e4e5d9691665dc79e78b0
|
||||||
msgid "guanaco(7b,13b,33b)"
|
msgid "guanaco(7b,13b,33b)"
|
||||||
msgstr "guanaco(7b,13b,33b)"
|
msgstr "guanaco(7b,13b,33b)"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:17
|
#: ../../getting_started/install/llm/llm.rst:18
|
||||||
#: 25abad241f4d4eee970d5938bf71311f
|
#: bd97e381ac6743e4a03df54b980ac5b9
|
||||||
msgid "Gorilla(7b,13b)"
|
msgid "Gorilla(7b,13b)"
|
||||||
msgstr "Gorilla(7b,13b)"
|
msgstr "Gorilla(7b,13b)"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:18
|
#: ../../getting_started/install/llm/llm.rst:19
|
||||||
#: 8e3d0399431a4c6a9065a8ae0ad3c8ac
|
#: 8d46081371b34471ba8f1dbc374955be
|
||||||
msgid "Baichuan(7b,13b)"
|
msgid "Baichuan(7b,13b)"
|
||||||
msgstr "Baichuan(7b,13b)"
|
msgstr "Baichuan(7b,13b)"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:19
|
#: ../../getting_started/install/llm/llm.rst:20
|
||||||
#: c285fa7c9c6c4e3e9840761a09955348
|
#: 08a1d4b2abac4effbc236fcd38f9a205
|
||||||
msgid "OpenAI"
|
msgid "OpenAI"
|
||||||
msgstr "OpenAI"
|
msgstr "OpenAI"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:21
|
#: ../../getting_started/install/llm/llm.rst:22
|
||||||
#: 4ac13a21f323455982750bd2e0243b72
|
#: 4f1e438738854cf1ad35800ddbeb9e12
|
||||||
msgid "llama_cpp"
|
msgid "llama_cpp"
|
||||||
msgstr "llama_cpp"
|
msgstr "llama_cpp"
|
||||||
|
|
||||||
#: ../../getting_started/install/llm/llm.rst:22
|
#: ../../getting_started/install/llm/llm.rst:23
|
||||||
#: 7231edceef584724a6f569c6b363e083
|
#: 5db1549fcfca4744b441cde5922d7fd3
|
||||||
msgid "quantization"
|
msgid "quantization"
|
||||||
msgstr "quantization"
|
msgstr "quantization"
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
"""加载组件"""
|
"""加载组件"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@ -8,17 +9,19 @@ import requests
|
|||||||
import threading
|
import threading
|
||||||
import datetime
|
import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List, TYPE_CHECKING
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from zipimport import zipimporter
|
from zipimport import zipimporter
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from auto_gpt_plugin_template import AutoGPTPluginTemplate
|
|
||||||
|
|
||||||
from pilot.configs.config import Config
|
from pilot.configs.config import Config
|
||||||
from pilot.configs.model_config import PLUGINS_DIR
|
from pilot.configs.model_config import PLUGINS_DIR
|
||||||
from pilot.logs import logger
|
from pilot.logs import logger
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from auto_gpt_plugin_template import AutoGPTPluginTemplate
|
||||||
|
|
||||||
|
|
||||||
def inspect_zip_for_modules(zip_path: str, debug: bool = False) -> list[str]:
|
def inspect_zip_for_modules(zip_path: str, debug: bool = False) -> list[str]:
|
||||||
"""
|
"""
|
||||||
@ -115,7 +118,7 @@ def load_native_plugins(cfg: Config):
|
|||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
|
|
||||||
def scan_plugins(cfg: Config, debug: bool = False) -> List[AutoGPTPluginTemplate]:
|
def scan_plugins(cfg: Config, debug: bool = False) -> List["AutoGPTPluginTemplate"]:
|
||||||
"""Scan the plugins directory for plugins and loads them.
|
"""Scan the plugins directory for plugins and loads them.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from typing import List
|
from typing import List, Optional, TYPE_CHECKING
|
||||||
|
|
||||||
from pilot.singleton import Singleton
|
from pilot.singleton import Singleton
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from auto_gpt_plugin_template import AutoGPTPluginTemplate
|
||||||
|
from pilot.component import SystemApp
|
||||||
|
|
||||||
|
|
||||||
class Config(metaclass=Singleton):
|
class Config(metaclass=Singleton):
|
||||||
"""Configuration class to store the state of bools for different scripts access"""
|
"""Configuration class to store the state of bools for different scripts access"""
|
||||||
@ -99,9 +104,8 @@ class Config(metaclass=Singleton):
|
|||||||
self.message_dir = os.getenv("MESSAGE_HISTORY_DIR", "../../message")
|
self.message_dir = os.getenv("MESSAGE_HISTORY_DIR", "../../message")
|
||||||
|
|
||||||
### The associated configuration parameters of the plug-in control the loading and use of the plug-in
|
### The associated configuration parameters of the plug-in control the loading and use of the plug-in
|
||||||
from auto_gpt_plugin_template import AutoGPTPluginTemplate
|
|
||||||
|
|
||||||
self.plugins: List[AutoGPTPluginTemplate] = []
|
self.plugins: List["AutoGPTPluginTemplate"] = []
|
||||||
self.plugins_openai = []
|
self.plugins_openai = []
|
||||||
self.plugins_auto_load = os.getenv("AUTO_LOAD_PLUGIN", "True") == "True"
|
self.plugins_auto_load = os.getenv("AUTO_LOAD_PLUGIN", "True") == "True"
|
||||||
|
|
||||||
@ -189,9 +193,7 @@ class Config(metaclass=Singleton):
|
|||||||
### Log level
|
### Log level
|
||||||
self.DBGPT_LOG_LEVEL = os.getenv("DBGPT_LOG_LEVEL", "INFO")
|
self.DBGPT_LOG_LEVEL = os.getenv("DBGPT_LOG_LEVEL", "INFO")
|
||||||
|
|
||||||
from pilot.component import SystemApp
|
self.SYSTEM_APP: Optional["SystemApp"] = None
|
||||||
|
|
||||||
self.SYSTEM_APP: SystemApp = None
|
|
||||||
|
|
||||||
def set_debug_mode(self, value: bool) -> None:
|
def set_debug_mode(self, value: bool) -> None:
|
||||||
"""Set the debug mode value"""
|
"""Set the debug mode value"""
|
||||||
|
@ -23,15 +23,18 @@ os.chdir(new_directory)
|
|||||||
|
|
||||||
|
|
||||||
def get_device() -> str:
|
def get_device() -> str:
|
||||||
import torch
|
try:
|
||||||
|
import torch
|
||||||
|
|
||||||
return (
|
return (
|
||||||
"cuda"
|
"cuda"
|
||||||
if torch.cuda.is_available()
|
if torch.cuda.is_available()
|
||||||
else "mps"
|
else "mps"
|
||||||
if torch.backends.mps.is_available()
|
if torch.backends.mps.is_available()
|
||||||
else "cpu"
|
else "cpu"
|
||||||
)
|
)
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
return "cpu"
|
||||||
|
|
||||||
|
|
||||||
LLM_MODEL_CONFIG = {
|
LLM_MODEL_CONFIG = {
|
||||||
@ -70,8 +73,9 @@ LLM_MODEL_CONFIG = {
|
|||||||
"wizardlm-13b": os.path.join(MODEL_PATH, "WizardLM-13B-V1.2"),
|
"wizardlm-13b": os.path.join(MODEL_PATH, "WizardLM-13B-V1.2"),
|
||||||
"llama-cpp": os.path.join(MODEL_PATH, "ggml-model-q4_0.bin"),
|
"llama-cpp": os.path.join(MODEL_PATH, "ggml-model-q4_0.bin"),
|
||||||
# https://huggingface.co/internlm/internlm-chat-7b-v1_1, 7b vs 7b-v1.1: https://github.com/InternLM/InternLM/issues/288
|
# https://huggingface.co/internlm/internlm-chat-7b-v1_1, 7b vs 7b-v1.1: https://github.com/InternLM/InternLM/issues/288
|
||||||
"internlm-7b": os.path.join(MODEL_PATH, "internlm-chat-7b-v1_1"),
|
"internlm-7b": os.path.join(MODEL_PATH, "internlm-chat-7b"),
|
||||||
"internlm-7b-8k": os.path.join(MODEL_PATH, "internlm-chat-7b-8k"),
|
"internlm-7b-8k": os.path.join(MODEL_PATH, "internlm-chat-7b-8k"),
|
||||||
|
"internlm-20b": os.path.join(MODEL_PATH, "internlm-20b-chat"),
|
||||||
}
|
}
|
||||||
|
|
||||||
EMBEDDING_MODEL_CONFIG = {
|
EMBEDDING_MODEL_CONFIG = {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from chromadb.errors import NotEnoughElementsException
|
|
||||||
from langchain.text_splitter import TextSplitter
|
from langchain.text_splitter import TextSplitter
|
||||||
|
|
||||||
from pilot.embedding_engine.embedding_factory import (
|
from pilot.embedding_engine.embedding_factory import (
|
||||||
@ -69,10 +68,10 @@ class EmbeddingEngine:
|
|||||||
vector_client = VectorStoreConnector(
|
vector_client = VectorStoreConnector(
|
||||||
self.vector_store_config["vector_store_type"], self.vector_store_config
|
self.vector_store_config["vector_store_type"], self.vector_store_config
|
||||||
)
|
)
|
||||||
try:
|
# https://github.com/chroma-core/chroma/issues/657
|
||||||
ans = vector_client.similar_search(text, topk)
|
ans = vector_client.similar_search(text, topk)
|
||||||
except NotEnoughElementsException:
|
# except NotEnoughElementsException:
|
||||||
ans = vector_client.similar_search(text, 1)
|
# ans = vector_client.similar_search(text, 1)
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
def vector_exist(self):
|
def vector_exist(self):
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import os
|
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
import markdown
|
import markdown
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
from chromadb.errors import NotEnoughElementsException
|
|
||||||
from langchain.text_splitter import TextSplitter
|
from langchain.text_splitter import TextSplitter
|
||||||
|
|
||||||
from pilot.vector_store.connector import VectorStoreConnector
|
from pilot.vector_store.connector import VectorStoreConnector
|
||||||
@ -71,10 +70,9 @@ class SourceEmbedding(ABC):
|
|||||||
self.vector_client = VectorStoreConnector(
|
self.vector_client = VectorStoreConnector(
|
||||||
self.vector_store_config["vector_store_type"], self.vector_store_config
|
self.vector_store_config["vector_store_type"], self.vector_store_config
|
||||||
)
|
)
|
||||||
try:
|
# https://github.com/chroma-core/chroma/issues/657
|
||||||
ans = self.vector_client.similar_search(doc, topk)
|
ans = self.vector_client.similar_search(doc, topk)
|
||||||
except NotEnoughElementsException:
|
# ans = self.vector_client.similar_search(doc, 1)
|
||||||
ans = self.vector_client.similar_search(doc, 1)
|
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
def vector_name_exist(self):
|
def vector_name_exist(self):
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import logging
|
import logging
|
||||||
import platform
|
|
||||||
from typing import Dict, Iterator, List
|
from typing import Dict, Iterator, List
|
||||||
|
|
||||||
from pilot.configs.model_config import get_device
|
from pilot.configs.model_config import get_device
|
||||||
@ -12,7 +11,7 @@ from pilot.server.chat_adapter import get_llm_chat_adapter, BaseChatAdpter
|
|||||||
from pilot.utils.model_utils import _clear_torch_cache
|
from pilot.utils.model_utils import _clear_torch_cache
|
||||||
from pilot.utils.parameter_utils import EnvArgumentParser
|
from pilot.utils.parameter_utils import EnvArgumentParser
|
||||||
|
|
||||||
logger = logging.getLogger("model_worker")
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DefaultModelWorker(ModelWorker):
|
class DefaultModelWorker(ModelWorker):
|
||||||
@ -91,8 +90,13 @@ class DefaultModelWorker(ModelWorker):
|
|||||||
_clear_torch_cache(self._model_params.device)
|
_clear_torch_cache(self._model_params.device)
|
||||||
|
|
||||||
def generate_stream(self, params: Dict) -> Iterator[ModelOutput]:
|
def generate_stream(self, params: Dict) -> Iterator[ModelOutput]:
|
||||||
import torch
|
torch_imported = False
|
||||||
|
try:
|
||||||
|
import torch
|
||||||
|
|
||||||
|
torch_imported = True
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
# params adaptation
|
# params adaptation
|
||||||
params, model_context = self.llm_chat_adapter.model_adaptation(
|
params, model_context = self.llm_chat_adapter.model_adaptation(
|
||||||
@ -117,16 +121,17 @@ class DefaultModelWorker(ModelWorker):
|
|||||||
)
|
)
|
||||||
yield model_output
|
yield model_output
|
||||||
print(f"\n\nfull stream output:\n{previous_response}")
|
print(f"\n\nfull stream output:\n{previous_response}")
|
||||||
except torch.cuda.CudaError:
|
|
||||||
model_output = ModelOutput(
|
|
||||||
text="**GPU OutOfMemory, Please Refresh.**", error_code=0
|
|
||||||
)
|
|
||||||
yield model_output
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
model_output = ModelOutput(
|
# Check if the exception is a torch.cuda.CudaError and if torch was imported.
|
||||||
text=f"**LLMServer Generate Error, Please CheckErrorInfo.**: {e}",
|
if torch_imported and isinstance(e, torch.cuda.CudaError):
|
||||||
error_code=0,
|
model_output = ModelOutput(
|
||||||
)
|
text="**GPU OutOfMemory, Please Refresh.**", error_code=0
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
model_output = ModelOutput(
|
||||||
|
text=f"**LLMServer Generate Error, Please CheckErrorInfo.**: {e}",
|
||||||
|
error_code=0,
|
||||||
|
)
|
||||||
yield model_output
|
yield model_output
|
||||||
|
|
||||||
def generate(self, params: Dict) -> ModelOutput:
|
def generate(self, params: Dict) -> ModelOutput:
|
||||||
|
@ -5,6 +5,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
|
import logging
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from dataclasses import asdict
|
from dataclasses import asdict
|
||||||
from typing import Awaitable, Callable, Dict, Iterator, List, Optional
|
from typing import Awaitable, Callable, Dict, Iterator, List, Optional
|
||||||
@ -12,7 +13,6 @@ from typing import Awaitable, Callable, Dict, Iterator, List, Optional
|
|||||||
from fastapi import APIRouter, FastAPI
|
from fastapi import APIRouter, FastAPI
|
||||||
from fastapi.responses import StreamingResponse
|
from fastapi.responses import StreamingResponse
|
||||||
from pilot.component import SystemApp
|
from pilot.component import SystemApp
|
||||||
from pilot.configs.model_config import LOGDIR
|
|
||||||
from pilot.model.base import (
|
from pilot.model.base import (
|
||||||
ModelInstance,
|
ModelInstance,
|
||||||
ModelOutput,
|
ModelOutput,
|
||||||
@ -30,15 +30,13 @@ from pilot.model.cluster.manager_base import (
|
|||||||
WorkerManagerFactory,
|
WorkerManagerFactory,
|
||||||
)
|
)
|
||||||
from pilot.model.cluster.base import *
|
from pilot.model.cluster.base import *
|
||||||
from pilot.utils import build_logger
|
|
||||||
from pilot.utils.parameter_utils import (
|
from pilot.utils.parameter_utils import (
|
||||||
EnvArgumentParser,
|
EnvArgumentParser,
|
||||||
ParameterDescription,
|
ParameterDescription,
|
||||||
_dict_to_command_args,
|
_dict_to_command_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = build_logger("model_worker", LOGDIR + "/model_worker.log")
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
RegisterFunc = Callable[[WorkerRunData], Awaitable[None]]
|
RegisterFunc = Callable[[WorkerRunData], Awaitable[None]]
|
||||||
DeregisterFunc = Callable[[WorkerRunData], Awaitable[None]]
|
DeregisterFunc = Callable[[WorkerRunData], Awaitable[None]]
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import bardapi
|
|
||||||
import requests
|
import requests
|
||||||
from typing import List
|
from typing import List
|
||||||
from pilot.scene.base_message import ModelMessage, ModelMessageRoleType
|
from pilot.scene.base_message import ModelMessage, ModelMessageRoleType
|
||||||
@ -52,6 +51,8 @@ def bard_generate_stream(
|
|||||||
else:
|
else:
|
||||||
yield f"bard proxy url request failed!, response = {str(response)}"
|
yield f"bard proxy url request failed!, response = {str(response)}"
|
||||||
else:
|
else:
|
||||||
|
import bardapi
|
||||||
|
|
||||||
response = bardapi.core.Bard(proxy_api_key).get_answer("\n".join(msgs))
|
response = bardapi.core.Bard(proxy_api_key).get_answer("\n".join(msgs))
|
||||||
|
|
||||||
if response is not None and response.get("content") is not None:
|
if response is not None and response.get("content") is not None:
|
||||||
|
@ -10,9 +10,6 @@ from pilot.scene.base_chat import BaseChat
|
|||||||
from pilot.scene.base import ChatScene
|
from pilot.scene.base import ChatScene
|
||||||
from pilot.common.sql_database import Database
|
from pilot.common.sql_database import Database
|
||||||
from pilot.configs.config import Config
|
from pilot.configs.config import Config
|
||||||
from pilot.common.markdown_text import (
|
|
||||||
generate_htm_table,
|
|
||||||
)
|
|
||||||
from pilot.scene.chat_data.chat_excel.excel_learning.prompt import prompt
|
from pilot.scene.chat_data.chat_excel.excel_learning.prompt import prompt
|
||||||
from pilot.scene.chat_data.chat_excel.excel_reader import ExcelReader
|
from pilot.scene.chat_data.chat_excel.excel_reader import ExcelReader
|
||||||
from pilot.json_utils.utilities import DateTimeEncoder
|
from pilot.json_utils.utilities import DateTimeEncoder
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from chromadb.errors import NoIndexException
|
|
||||||
|
|
||||||
from pilot.scene.base_chat import BaseChat
|
from pilot.scene.base_chat import BaseChat
|
||||||
from pilot.scene.base import ChatScene
|
from pilot.scene.base import ChatScene
|
||||||
from pilot.configs.config import Config
|
from pilot.configs.config import Config
|
||||||
@ -59,22 +57,19 @@ class ChatKnowledge(BaseChat):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def generate_input_values(self):
|
def generate_input_values(self):
|
||||||
try:
|
if self.space_context:
|
||||||
if self.space_context:
|
self.prompt_template.template_define = self.space_context["prompt"]["scene"]
|
||||||
self.prompt_template.template_define = self.space_context["prompt"][
|
self.prompt_template.template = self.space_context["prompt"]["template"]
|
||||||
"scene"
|
docs = self.knowledge_embedding_client.similar_search(
|
||||||
]
|
self.current_user_input, self.top_k
|
||||||
self.prompt_template.template = self.space_context["prompt"]["template"]
|
)
|
||||||
docs = self.knowledge_embedding_client.similar_search(
|
if not docs:
|
||||||
self.current_user_input, self.top_k
|
|
||||||
)
|
|
||||||
context = [d.page_content for d in docs]
|
|
||||||
context = context[: self.max_token]
|
|
||||||
input_values = {"context": context, "question": self.current_user_input}
|
|
||||||
except NoIndexException:
|
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"you have no knowledge space, please add your knowledge space"
|
"you have no knowledge space, please add your knowledge space"
|
||||||
)
|
)
|
||||||
|
context = [d.page_content for d in docs]
|
||||||
|
context = context[: self.max_token]
|
||||||
|
input_values = {"context": context, "question": self.current_user_input}
|
||||||
return input_values
|
return input_values
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -71,7 +71,7 @@ def load(
|
|||||||
skip_wrong_doc: bool,
|
skip_wrong_doc: bool,
|
||||||
max_workers: int,
|
max_workers: int,
|
||||||
):
|
):
|
||||||
"""Load you local knowledge to DB-GPT"""
|
"""Load your local knowledge to DB-GPT"""
|
||||||
from pilot.server.knowledge._cli.knowledge_client import knowledge_init
|
from pilot.server.knowledge._cli.knowledge_client import knowledge_init
|
||||||
|
|
||||||
knowledge_init(
|
knowledge_init(
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -170,8 +170,9 @@ class DBSummaryClient:
|
|||||||
def init_db_profile(self, db_summary_client, dbname, embeddings):
|
def init_db_profile(self, db_summary_client, dbname, embeddings):
|
||||||
from pilot.embedding_engine.string_embedding import StringEmbedding
|
from pilot.embedding_engine.string_embedding import StringEmbedding
|
||||||
|
|
||||||
|
vector_store_name = dbname + "_profile"
|
||||||
profile_store_config = {
|
profile_store_config = {
|
||||||
"vector_store_name": dbname + "_profile",
|
"vector_store_name": vector_store_name,
|
||||||
"chroma_persist_path": KNOWLEDGE_UPLOAD_ROOT_PATH,
|
"chroma_persist_path": KNOWLEDGE_UPLOAD_ROOT_PATH,
|
||||||
"vector_store_type": CFG.VECTOR_STORE_TYPE,
|
"vector_store_type": CFG.VECTOR_STORE_TYPE,
|
||||||
"embeddings": embeddings,
|
"embeddings": embeddings,
|
||||||
@ -190,6 +191,8 @@ class DBSummaryClient:
|
|||||||
)
|
)
|
||||||
docs.extend(embedding.read_batch())
|
docs.extend(embedding.read_batch())
|
||||||
embedding.index_to_store(docs)
|
embedding.index_to_store(docs)
|
||||||
|
else:
|
||||||
|
logger.info(f"Vector store name {vector_store_name} exist")
|
||||||
logger.info("init db profile success...")
|
logger.info("init db profile success...")
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import os
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from chromadb.config import Settings
|
from chromadb.config import Settings
|
||||||
|
from chromadb import PersistentClient
|
||||||
from pilot.logs import logger
|
from pilot.logs import logger
|
||||||
from pilot.vector_store.base import VectorStoreBase
|
from pilot.vector_store.base import VectorStoreBase
|
||||||
|
|
||||||
@ -18,15 +19,18 @@ class ChromaStore(VectorStoreBase):
|
|||||||
ctx["chroma_persist_path"], ctx["vector_store_name"] + ".vectordb"
|
ctx["chroma_persist_path"], ctx["vector_store_name"] + ".vectordb"
|
||||||
)
|
)
|
||||||
chroma_settings = Settings(
|
chroma_settings = Settings(
|
||||||
chroma_db_impl="duckdb+parquet",
|
# chroma_db_impl="duckdb+parquet", => deprecated configuration of Chroma
|
||||||
persist_directory=self.persist_dir,
|
persist_directory=self.persist_dir,
|
||||||
anonymized_telemetry=False,
|
anonymized_telemetry=False,
|
||||||
)
|
)
|
||||||
|
client = PersistentClient(path=self.persist_dir, settings=chroma_settings)
|
||||||
|
|
||||||
collection_metadata = {"hnsw:space": "cosine"}
|
collection_metadata = {"hnsw:space": "cosine"}
|
||||||
self.vector_store_client = Chroma(
|
self.vector_store_client = Chroma(
|
||||||
persist_directory=self.persist_dir,
|
persist_directory=self.persist_dir,
|
||||||
embedding_function=self.embeddings,
|
embedding_function=self.embeddings,
|
||||||
client_settings=chroma_settings,
|
# client_settings=chroma_settings,
|
||||||
|
client=client,
|
||||||
collection_metadata=collection_metadata,
|
collection_metadata=collection_metadata,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -35,9 +39,13 @@ class ChromaStore(VectorStoreBase):
|
|||||||
return self.vector_store_client.similarity_search(text, topk)
|
return self.vector_store_client.similarity_search(text, topk)
|
||||||
|
|
||||||
def vector_name_exists(self):
|
def vector_name_exists(self):
|
||||||
return (
|
logger.info(f"Check persist_dir: {self.persist_dir}")
|
||||||
os.path.exists(self.persist_dir) and len(os.listdir(self.persist_dir)) > 0
|
if not os.path.exists(self.persist_dir):
|
||||||
)
|
return False
|
||||||
|
files = os.listdir(self.persist_dir)
|
||||||
|
# Skip default file: chroma.sqlite3
|
||||||
|
files = list(filter(lambda f: f != "chroma.sqlite3", files))
|
||||||
|
return len(files) > 0
|
||||||
|
|
||||||
def load_document(self, documents):
|
def load_document(self, documents):
|
||||||
logger.info("ChromaStore load document")
|
logger.info("ChromaStore load document")
|
||||||
|
@ -1,84 +0,0 @@
|
|||||||
# torch==2.0.0
|
|
||||||
aiohttp==3.8.4
|
|
||||||
aiosignal==1.3.1
|
|
||||||
async-timeout==4.0.2
|
|
||||||
attrs==22.2.0
|
|
||||||
cchardet==2.1.7
|
|
||||||
chardet==5.1.0
|
|
||||||
# contourpy==1.0.7
|
|
||||||
# cycler==0.11.0
|
|
||||||
filelock==3.9.0
|
|
||||||
fonttools==4.38.0
|
|
||||||
frozenlist==1.3.3
|
|
||||||
huggingface-hub==0.14.1
|
|
||||||
importlib-resources==5.12.0
|
|
||||||
|
|
||||||
sqlparse==0.4.4
|
|
||||||
# kiwisolver==1.4.4
|
|
||||||
# matplotlib==3.7.1
|
|
||||||
multidict==6.0.4
|
|
||||||
packaging==23.0
|
|
||||||
psutil==5.9.4
|
|
||||||
# pycocotools==2.0.6
|
|
||||||
# pyparsing==3.0.9
|
|
||||||
python-dateutil==2.8.2
|
|
||||||
pyyaml==6.0
|
|
||||||
tokenizers==0.13.2
|
|
||||||
tqdm==4.64.1
|
|
||||||
transformers>=4.31.0
|
|
||||||
transformers_stream_generator
|
|
||||||
# timm==0.6.13
|
|
||||||
spacy==3.5.3
|
|
||||||
webdataset==0.2.48
|
|
||||||
yarl==1.8.2
|
|
||||||
zipp==3.14.0
|
|
||||||
omegaconf==2.3.0
|
|
||||||
opencv-python==4.7.0.72
|
|
||||||
iopath==0.1.10
|
|
||||||
tenacity==8.2.2
|
|
||||||
peft
|
|
||||||
# TODO remove pycocoevalcap
|
|
||||||
pycocoevalcap
|
|
||||||
cpm_kernels
|
|
||||||
umap-learn
|
|
||||||
# notebook
|
|
||||||
gradio==3.23
|
|
||||||
gradio-client==0.0.8
|
|
||||||
# wandb
|
|
||||||
# llama-index==0.5.27
|
|
||||||
|
|
||||||
# TODO move bitsandbytes to optional
|
|
||||||
# bitsandbytes
|
|
||||||
accelerate>=0.20.3
|
|
||||||
|
|
||||||
unstructured==0.6.3
|
|
||||||
gpt4all==0.3.0
|
|
||||||
diskcache==5.6.1
|
|
||||||
seaborn
|
|
||||||
auto-gpt-plugin-template
|
|
||||||
pymdown-extensions
|
|
||||||
gTTS==2.3.1
|
|
||||||
langchain>=0.0.286
|
|
||||||
nltk
|
|
||||||
python-dotenv==1.0.0
|
|
||||||
|
|
||||||
vcrpy
|
|
||||||
chromadb==0.3.22
|
|
||||||
markdown2
|
|
||||||
colorama
|
|
||||||
playsound
|
|
||||||
distro
|
|
||||||
pypdf
|
|
||||||
weaviate-client
|
|
||||||
bardapi==0.1.29
|
|
||||||
|
|
||||||
# database
|
|
||||||
|
|
||||||
# TODO moved to optional dependencies
|
|
||||||
pymysql
|
|
||||||
duckdb
|
|
||||||
duckdb-engine
|
|
||||||
|
|
||||||
# cli
|
|
||||||
prettytable
|
|
||||||
cachetools
|
|
@ -1,4 +1,4 @@
|
|||||||
# Testing dependencies
|
# Testing and dev dependencies
|
||||||
pytest
|
pytest
|
||||||
asynctest
|
asynctest
|
||||||
pytest-asyncio
|
pytest-asyncio
|
||||||
@ -7,4 +7,6 @@ pytest-cov
|
|||||||
pytest-integration
|
pytest-integration
|
||||||
pytest-mock
|
pytest-mock
|
||||||
pytest-recording
|
pytest-recording
|
||||||
pytesseract==0.3.10
|
pytesseract==0.3.10
|
||||||
|
# python code format
|
||||||
|
black
|
117
setup.py
117
setup.py
@ -10,7 +10,6 @@ from urllib.parse import urlparse, quote
|
|||||||
import re
|
import re
|
||||||
from pip._internal.utils.appdirs import user_cache_dir
|
from pip._internal.utils.appdirs import user_cache_dir
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
|
||||||
from setuptools import find_packages
|
from setuptools import find_packages
|
||||||
|
|
||||||
with open("README.md", mode="r", encoding="utf-8") as fh:
|
with open("README.md", mode="r", encoding="utf-8") as fh:
|
||||||
@ -74,7 +73,6 @@ def cache_package(package_url: str, package_name: str, is_windows: bool = False)
|
|||||||
|
|
||||||
local_path = os.path.join(cache_dir, filename)
|
local_path = os.path.join(cache_dir, filename)
|
||||||
if not os.path.exists(local_path):
|
if not os.path.exists(local_path):
|
||||||
# temp_file, temp_path = tempfile.mkstemp()
|
|
||||||
temp_path = local_path + ".tmp"
|
temp_path = local_path + ".tmp"
|
||||||
if os.path.exists(temp_path):
|
if os.path.exists(temp_path):
|
||||||
os.remove(temp_path)
|
os.remove(temp_path)
|
||||||
@ -204,23 +202,16 @@ def torch_requires(
|
|||||||
torchvision_version: str = "0.15.1",
|
torchvision_version: str = "0.15.1",
|
||||||
torchaudio_version: str = "2.0.1",
|
torchaudio_version: str = "2.0.1",
|
||||||
):
|
):
|
||||||
torch_pkgs = []
|
torch_pkgs = [
|
||||||
|
f"torch=={torch_version}",
|
||||||
|
f"torchvision=={torchvision_version}",
|
||||||
|
f"torchaudio=={torchaudio_version}",
|
||||||
|
]
|
||||||
|
torch_cuda_pkgs = []
|
||||||
os_type, _ = get_cpu_avx_support()
|
os_type, _ = get_cpu_avx_support()
|
||||||
if os_type == OSType.DARWIN:
|
if os_type != OSType.DARWIN:
|
||||||
torch_pkgs = [
|
|
||||||
f"torch=={torch_version}",
|
|
||||||
f"torchvision=={torchvision_version}",
|
|
||||||
f"torchaudio=={torchaudio_version}",
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
cuda_version = get_cuda_version()
|
cuda_version = get_cuda_version()
|
||||||
if not cuda_version:
|
if cuda_version:
|
||||||
torch_pkgs = [
|
|
||||||
f"torch=={torch_version}",
|
|
||||||
f"torchvision=={torchvision_version}",
|
|
||||||
f"torchaudio=={torchaudio_version}",
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
supported_versions = ["11.7", "11.8"]
|
supported_versions = ["11.7", "11.8"]
|
||||||
if cuda_version not in supported_versions:
|
if cuda_version not in supported_versions:
|
||||||
print(
|
print(
|
||||||
@ -238,12 +229,16 @@ def torch_requires(
|
|||||||
torchvision_url_cached = cache_package(
|
torchvision_url_cached = cache_package(
|
||||||
torchvision_url, "torchvision", os_type == OSType.WINDOWS
|
torchvision_url, "torchvision", os_type == OSType.WINDOWS
|
||||||
)
|
)
|
||||||
torch_pkgs = [
|
|
||||||
|
torch_cuda_pkgs = [
|
||||||
f"torch @ {torch_url_cached}",
|
f"torch @ {torch_url_cached}",
|
||||||
f"torchvision @ {torchvision_url_cached}",
|
f"torchvision @ {torchvision_url_cached}",
|
||||||
f"torchaudio=={torchaudio_version}",
|
f"torchaudio=={torchaudio_version}",
|
||||||
]
|
]
|
||||||
|
|
||||||
setup_spec.extras["torch"] = torch_pkgs
|
setup_spec.extras["torch"] = torch_pkgs
|
||||||
|
setup_spec.extras["torch_cpu"] = torch_pkgs
|
||||||
|
setup_spec.extras["torch_cuda"] = torch_cuda_pkgs
|
||||||
|
|
||||||
|
|
||||||
def llama_cpp_python_cuda_requires():
|
def llama_cpp_python_cuda_requires():
|
||||||
@ -274,6 +269,57 @@ def llama_cpp_python_cuda_requires():
|
|||||||
setup_spec.extras["llama_cpp"].append(f"llama_cpp_python_cuda @ {extra_index_url}")
|
setup_spec.extras["llama_cpp"].append(f"llama_cpp_python_cuda @ {extra_index_url}")
|
||||||
|
|
||||||
|
|
||||||
|
def core_requires():
|
||||||
|
"""
|
||||||
|
pip install db-gpt or pip install "db-gpt[core]"
|
||||||
|
"""
|
||||||
|
setup_spec.extras["core"] = [
|
||||||
|
"aiohttp==3.8.4",
|
||||||
|
"chardet==5.1.0",
|
||||||
|
"importlib-resources==5.12.0",
|
||||||
|
"psutil==5.9.4",
|
||||||
|
"python-dotenv==1.0.0",
|
||||||
|
"colorama",
|
||||||
|
"prettytable",
|
||||||
|
"cachetools",
|
||||||
|
]
|
||||||
|
|
||||||
|
setup_spec.extras["framework"] = [
|
||||||
|
"httpx",
|
||||||
|
"sqlparse==0.4.4",
|
||||||
|
"seaborn",
|
||||||
|
# https://github.com/eosphoros-ai/DB-GPT/issues/551
|
||||||
|
"pandas==2.0.3",
|
||||||
|
"auto-gpt-plugin-template",
|
||||||
|
"gTTS==2.3.1",
|
||||||
|
"langchain>=0.0.286",
|
||||||
|
"SQLAlchemy",
|
||||||
|
"pymysql",
|
||||||
|
"duckdb",
|
||||||
|
"duckdb-engine",
|
||||||
|
"jsonschema",
|
||||||
|
# TODO move transformers to default
|
||||||
|
"transformers>=4.31.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def knowledge_requires():
|
||||||
|
"""
|
||||||
|
pip install "db-gpt[knowledge]"
|
||||||
|
"""
|
||||||
|
setup_spec.extras["knowledge"] = [
|
||||||
|
"spacy==3.5.3",
|
||||||
|
# "chromadb==0.3.22",
|
||||||
|
"chromadb",
|
||||||
|
"markdown",
|
||||||
|
"bs4",
|
||||||
|
"python-pptx",
|
||||||
|
"python-docx",
|
||||||
|
"pypdf",
|
||||||
|
"python-multipart",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def llama_cpp_requires():
|
def llama_cpp_requires():
|
||||||
"""
|
"""
|
||||||
pip install "db-gpt[llama_cpp]"
|
pip install "db-gpt[llama_cpp]"
|
||||||
@ -309,6 +355,7 @@ def all_vector_store_requires():
|
|||||||
setup_spec.extras["vstore"] = [
|
setup_spec.extras["vstore"] = [
|
||||||
"grpcio==1.47.5", # maybe delete it
|
"grpcio==1.47.5", # maybe delete it
|
||||||
"pymilvus==2.2.1",
|
"pymilvus==2.2.1",
|
||||||
|
"weaviate-client",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -324,6 +371,31 @@ def openai_requires():
|
|||||||
pip install "db-gpt[openai]"
|
pip install "db-gpt[openai]"
|
||||||
"""
|
"""
|
||||||
setup_spec.extras["openai"] = ["openai", "tiktoken"]
|
setup_spec.extras["openai"] = ["openai", "tiktoken"]
|
||||||
|
setup_spec.extras["openai"] += setup_spec.extras["framework"]
|
||||||
|
setup_spec.extras["openai"] += setup_spec.extras["knowledge"]
|
||||||
|
|
||||||
|
|
||||||
|
def gpt4all_requires():
|
||||||
|
"""
|
||||||
|
pip install "db-gpt[gpt4all]"
|
||||||
|
"""
|
||||||
|
setup_spec.extras["gpt4all"] = ["gpt4all"]
|
||||||
|
|
||||||
|
|
||||||
|
def default_requires():
|
||||||
|
"""
|
||||||
|
pip install "db-gpt[default]"
|
||||||
|
"""
|
||||||
|
setup_spec.extras["default"] = [
|
||||||
|
"tokenizers==0.13.2",
|
||||||
|
"accelerate>=0.20.3",
|
||||||
|
"sentence-transformers",
|
||||||
|
"protobuf==3.20.3",
|
||||||
|
]
|
||||||
|
setup_spec.extras["default"] += setup_spec.extras["framework"]
|
||||||
|
setup_spec.extras["default"] += setup_spec.extras["knowledge"]
|
||||||
|
setup_spec.extras["default"] += setup_spec.extras["torch"]
|
||||||
|
setup_spec.extras["default"] += setup_spec.extras["quantization"]
|
||||||
|
|
||||||
|
|
||||||
def all_requires():
|
def all_requires():
|
||||||
@ -335,20 +407,23 @@ def all_requires():
|
|||||||
|
|
||||||
|
|
||||||
def init_install_requires():
|
def init_install_requires():
|
||||||
setup_spec.install_requires += parse_requirements("requirements.txt")
|
setup_spec.install_requires += setup_spec.extras["core"]
|
||||||
setup_spec.install_requires += setup_spec.extras["torch"]
|
|
||||||
setup_spec.install_requires += setup_spec.extras["quantization"]
|
|
||||||
print(f"Install requires: \n{','.join(setup_spec.install_requires)}")
|
print(f"Install requires: \n{','.join(setup_spec.install_requires)}")
|
||||||
|
|
||||||
|
|
||||||
|
core_requires()
|
||||||
torch_requires()
|
torch_requires()
|
||||||
|
knowledge_requires()
|
||||||
llama_cpp_requires()
|
llama_cpp_requires()
|
||||||
quantization_requires()
|
quantization_requires()
|
||||||
|
|
||||||
all_vector_store_requires()
|
all_vector_store_requires()
|
||||||
all_datasource_requires()
|
all_datasource_requires()
|
||||||
openai_requires()
|
openai_requires()
|
||||||
|
gpt4all_requires()
|
||||||
|
|
||||||
# must be last
|
# must be last
|
||||||
|
default_requires()
|
||||||
all_requires()
|
all_requires()
|
||||||
init_install_requires()
|
init_install_requires()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user