Skip to content

Commit

Permalink
Merge pull request #298 from netease-youdao/develop_for_v1.3.1
Browse files Browse the repository at this point in the history
Develop for v1.3.1
  • Loading branch information
xixihahaliu authored Apr 26, 2024
2 parents 3004bab + e393968 commit 0b0b51b
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 1 deletion.
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
ARG PIP_OPTIONS="-i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn"
FROM opencloudos/opencloudos:8.8

# 设置非交互式前端,防止在安装过程中出现交云提示
ENV DEBIAN_FRONTEND=noninteractive

RUN dnf update -y && dnf install -y wget vim tar gcc zlib zlib-devel bzip2 bzip2-devel ncurses ncurses-devel readline readline-devel openssl openssl-devel xz xz-devel sqlite sqlite-devel gdbm gdbm-devel tk tk-devel mysql-devel libffi-devel make mesa-libGL lsof gzip

RUN mkdir /build && cd /build && wget https://www.python.org/ftp/python/3.10.12/Python-3.10.12.tgz && tar -xvf Python-3.10.12.tgz && cd Python-3.10.12 && ./configure && make all && make install && ln -s /usr/local/bin/python3 /usr/bin/python3 && ln -s /usr/local/bin/pip3 /usr/bin/pip

RUN python3 -m pip install $PIP_OPTIONS --upgrade pip && pip install $PIP_OPTIONS --no-cache-dir --extra-index-url https://pypi.ngc.nvidia.com regex==2023.10.3 fire==0.5.0 && \
pip install $PIP_OPTIONS --no-cache-dir modelscope==1.13.0 \
Pillow==10.2.0 \
numpy==1.24.3 \
PyMuPDF==1.23.22 \
easyocr==1.7.1 \
onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/ \
# onnxruntime==1.17.1 \
torch==2.1.2 \
torchvision==0.16.2 \
transformers==4.36.2 \
vllm==0.2.7 \
openai==1.12.0 \
concurrent-log-handler==0.9.25 \
sentencepiece==0.1.99 \
tiktoken==0.6.0 \
sanic==23.6.0 \
sanic_ext==23.6.0 \
faiss-cpu==1.8.0 \
openpyxl==3.1.2 \
langchain==0.1.9 \
pypinyin==0.50.0 \
python-docx==1.1.0 \
unstructured==0.12.4 \
unstructured[pptx]==0.12.4 \
unstructured[md]==0.12.4 \
accelerate==0.21.0 \
networkx==3.2.1 \
python-dotenv==1.0.1 \
html2text==2024.2.26 \
duckduckgo-search==5.3.0 \
faster-whisper==1.0.1

# Add FT-backend

ENV WORKSPACE /workspace
WORKDIR /workspace

RUN mkdir /opt/tiktoken_cache
ARG TIKTOKEN_URL="https://openaipublic.blob.core.windows.net/encodings/cl100k_base.tiktoken"
RUN wget -O /opt/tiktoken_cache/$(echo -n $TIKTOKEN_URL | sha1sum | head -c 40) $TIKTOKEN_URL
ENV TIKTOKEN_CACHE_DIR=/opt/tiktoken_cache
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To install the package, run:
```bash
conda create -n qanything-python python=3.10
conda activate qanything-python
git clone -b qanything-python-v1.3.1 https://github.com/netease-youdao/QAnything.git
git clone -b qanything-python https://github.com/netease-youdao/QAnything.git
cd QAnything
pip install -e .
```
Expand Down Expand Up @@ -66,6 +66,20 @@ bash scripts/run_for_openai_api_in_M1_mac.sh
bash scripts/run_for_3B_in_M1_mac.sh
```

## Run in OpenCloud
OpenCloud Need Run in Docker Container, Please Install Docker First:
Docker version >= 20.10.5 and docker-compose version >= 2.23.3
```bash
docker-compose up -d
docker attach qanything-container
# Choose one of the 4 commands below to run:
bash scripts/run_for_3B_in_Linux_or_WSL.sh
bash scripts/run_for_7B_in_Linux_or_WSL.sh
bash scripts/run_for_openai_api_with_cpu_in_Linux_or_WSL.sh
bash scripts/run_for_openai_api_with_gpu_in_Linux_or_WSL.sh
```


## USE WITH WEB UI
Open http://0.0.0.0:8777/qanything/ in the browser to use the UI interface,

Expand Down
13 changes: 13 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ bash scripts/run_for_openai_api_in_M1_mac.sh
bash scripts/run_for_3B_in_M1_mac.sh
```

## 在OpenCloud操作系统中运行
OpenCloud 需要在 Docker 容器中运行,请先安装 Docker:
Docker 版本 >= 20.10.5 且 docker-compose 版本 >= 2.23.3
```bash
docker-compose up -d
docker attach qanything-container
# 选择以下4个命令之一来运行:
bash scripts/run_for_3B_in_Linux_or_WSL.sh
bash scripts/run_for_7B_in_Linux_or_WSL.sh
bash scripts/run_for_openai_api_with_cpu_in_Linux_or_WSL.sh
bash scripts/run_for_openai_api_with_gpu_in_Linux_or_WSL.sh
```

## 访问前端页面
在浏览器中打开http://0.0.0.0:8777/qanything/

Expand Down
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
services:
qanything:
container_name: qanything-container
image: freeren/qanything-opencloud:v1.0.1
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: "all"
capabilities: ["gpu"]
privileged: true
shm_size: '8gb'
ports:
- "8777:8777"
# command: /bin/bash -c 'pip install -e . && bash scripts/run_for_3B_in_Linux_or_WSL.sh'
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/:/workspace/
environment:
- NCCL_LAUNCH_MODE=PARALLEL
tty: true
stdin_open: true

0 comments on commit 0b0b51b

Please sign in to comment.