1、参考
参考代码:https://github.com/PaddlePaddle/PaddleNLP/tree/develop/applications/experimental/pipelines/examples/question-answering
可视化工具参考:https://streamlit.io/
ES安装参考:https://www.elastic.co/guide/en/enterprise-search/current/docker.html
镜像:PaddlePaddle镜像汇总参考
2、如何在docker内运行
2.1、requirements.txt安装包编写
paddlenlp==2.3.3
paddleocr==2.5.0.3
requests==2.28.0
pydantic==1.9.1
mmh3==3.0.0
more-itertools==8.13.0
elasticsearch==7.10.0
SQLAlchemy==1.4.37
SQLAlchemy-Utils==0.38.2
langdetect==1.0.9
python-docx==0.8.11
nltk==3.7
pdfplumber==0.7.1
importlib-metadata==4.2.0
faiss-gpu==1.7.2
2.2、docker指令运行
docker pull registry.baidubce.com/paddlepaddle/paddle:latest-gpu-cuda10.1-cudnn7-gcc54-dev
nvidia-docker run -it --entrypoint=/bin/bash registry.baidubce.com/paddlepaddle/paddle:latest-gpu-cuda10.1-cudnn7-gcc54-dev
pip3.7 install paddlepaddle-gpu==2.3.0.post101 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html
pip3.7 install -r requirements.txt
python3.7 setup.py install
python3.7 examples/question-answering/dense_qa_example.py --device gpu
2.3、dockerfile制作镜像运行,dockerfile内容
FROM registry.baidubce.com/paddlepaddle/paddle:latest-gpu-cuda10.1-cudnn7-gcc54-dev
COPY . /deploy
WORKDIR /deploy
RUN pip config set global.index-url https://mirror.baidu.com/pypi/simple \
&& python3.7 -m pip install --upgrade setuptools \
&& python3.7 -m pip install --upgrade pip \
&& python3.7 -m pip install paddlepaddle-gpu==2.3.0.post101 \
-f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html \
# 1) 安装 pipelines package\
&& cd pipelines/ \
&& pip3.7 install -r requirements.txt \
&& python3.7 setup.py install
ENTRYPOINT export CUDA_VISIBLE_DEVICES=0 && \
python3.7 pipelines/examples/question-answering/dense_qa_example.py --device gpu
2.3.1、dockerfile制作镜像
nvidia-docker build -t chatbot-qa:1.0.0.0630 .
nvidia-docker run --name chatbot-qa -d chatbot-qa:1.0.0.0630
nvidia-docker exec -it chatbot-qa /bin/bash
docker logs chatbot-qa