Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: latest AutoDL image #595

Merged
merged 2 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ The core capabilities mainly consist of the following parts:
- [DB-GPT-Web](https://github.com/eosphoros-ai/DB-GPT-Web) ChatUI for DB-GPT

## Image
🌐 [AutoDL Image](https://www.codewithgpu.com/i/csunny/DB-GPT/dbgpt-0.3.1-v2)
🌐 [AutoDL Image](https://www.codewithgpu.com/i/eosphoros-ai/DB-GPT/dbgpt)

## Install
![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white)
Expand Down
2 changes: 1 addition & 1 deletion README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ DB-GPT基于 [FastChat](https://github.com/lm-sys/FastChat) 构建大模型运

## Image

🌐 [AutoDL镜像](https://www.codewithgpu.com/i/csunny/DB-GPT/dbgpt-0.3.1-v2)
🌐 [AutoDL镜像](https://www.codewithgpu.com/i/eosphoros-ai/DB-GPT/dbgpt)

🌐 [阿里云镜像](http://dbgpt.site/web/#/p/dc4bb97e0bc15302dbf3a5d5571142dd)

Expand Down
2 changes: 1 addition & 1 deletion pilot/embedding_engine/loader/ppt_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def load(self) -> List[Document]:
docs = []
for slide in pr.slides:
for shape in slide.shapes:
if hasattr(shape, "text") and shape.text is not "":
if hasattr(shape, "text") and shape.text:
docs.append(
Document(
page_content=shape.text, metadata={"source": slide.slide_id}
Expand Down
108 changes: 97 additions & 11 deletions scripts/setup_autodl_env.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,105 @@
#!/bin/bash
eval "$(conda shell.bash hook)"
# This script is used for setting up the environment required for DB-GPT on https://www.autodl.com/

source ~/.bashrc
# Usage: source /etc/network_turbo && curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/eosphoros-ai/DB-GPT/main/scripts/setup_autodl_env.sh | bash

# source /etc/network_turbo
# unset http_proxy && unset https_proxy
conda create -n dbgpt python=3.10 -y
# autodl usage:
# conda activate dbgpt
# cd /root/DB-GPT
# bash scripts/examples/load_examples.sh
# dbgpt start webserver --port 6006

conda activate dbgpt
DEFAULT_PROXY="true"
USE_PROXY=$DEFAULT_PROXY

apt-get update -y && apt-get install git-lfs -y
initialize_conda() {
conda init bash
eval "$(conda shell.bash hook)"
source ~/.bashrc
if [[ $USE_PROXY == "true" ]]; then
source /etc/network_turbo
# unset http_proxy && unset https_proxy
fi
}

cd /root && git clone https://github.com/eosphoros-ai/DB-GPT.git
setup_conda_environment() {
conda create -n dbgpt python=3.10 -y
conda activate dbgpt
}

mkdir -p /root/DB-GPT/models && cd /root/DB-GPT/models
install_sys_packages() {
apt-get update -y && apt-get install git-lfs -y
}

git clone https://huggingface.co/GanymedeNil/text2vec-large-chinese
git clone https://huggingface.co/THUDM/chatglm2-6b-int4
clone_repositories() {
cd /root && git clone https://github.com/eosphoros-ai/DB-GPT.git
mkdir -p /root/DB-GPT/models && cd /root/DB-GPT/models
git clone https://huggingface.co/GanymedeNil/text2vec-large-chinese
git clone https://huggingface.co/THUDM/chatglm2-6b-int4
rm -rf /root/DB-GPT/models/text2vec-large-chinese/.git
rm -rf /root/DB-GPT/models/chatglm2-6b-int4/.git
}

install_dbgpt_packages() {
conda activate dbgpt && cd /root/DB-GPT && pip install -e . && cp .env.template .env
cp .env.template .env && sed -i 's/LLM_MODEL=vicuna-13b-v1.5/LLM_MODEL=chatglm2-6b-int4/' .env

}

clean_up() {
rm -rf `pip cache dir`
apt-get clean
rm -f ~/.bash_history
history -c
}

clean_local_data() {
rm -rf /root/DB-GPT/pilot/data
rm -rf /root/DB-GPT/pilot/message
rm -f /root/DB-GPT/logs/*
rm -f /root/DB-GPT/logsDbChatOutputParser.log
}

usage() {
echo "USAGE: $0 [--use-proxy]"
echo " [--use-proxy] Use proxy settings (Optional)"
echo " [-h|--help] Usage message"
}

# Command line arguments parsing
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
--use-proxy)
USE_PROXY="true"
shift
;;
-h|--help)
help="true"
shift
;;
*)
usage
exit 1
;;
esac
done

if [[ $help ]]; then
usage
exit 0
fi

# Main execution

if [[ $USE_PROXY == "true" ]]; then
echo "Using proxy settings..."
source /etc/network_turbo
fi

initialize_conda
setup_conda_environment
install_sys_packages
clone_repositories
install_dbgpt_packages
clean_up