Skip to content

Commit 8e729fb

Browse files
committed
Add index.md
1 parent 0a46290 commit 8e729fb

File tree

1 file changed

+229
-0
lines changed

1 file changed

+229
-0
lines changed

pipelines/docs/index.md

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
## PaddleNLP Pipelines:NLP流水线系统
2+
3+
PaddleNLP Pipelines 是一个端到端NLP流水线系统框架,面向 NLP **全场景**,帮助用户**低门槛**构建强大**产品级系统**
4+
5+
<div align="center">
6+
<img src="https://user-images.githubusercontent.com/12107462/190302765-663ba441-9dd3-470a-8fee-f7a6f81da615.gif" width="500px">
7+
</div>
8+
9+
更多效果展示Demo请参考 [效果展示](#效果展示)
10+
11+
## NLP流水线系统特色
12+
* **全场景支持**:依托灵活的插拔式组件产线化设计,支持各类 NLP 场景任务,包括:信息抽取、情感倾向分析、阅读理解、检索系统、问答系统、文本分类、文本生成等。
13+
14+
* **低门槛开发**:依托丰富的预置组件,像搭积木一样快速构建产品级系统,预置组件覆盖文档解析、数据处理、模型组网、预测部署、Web 服务、UI 界面等全流程系统功能。
15+
16+
* **高精度预测**:基于前沿的预训练模型、成熟的系统方案,可构建效果领先的产品级系统,如[NLP流水线系统](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines#NLP流水线系统)中预置的语义检索系统、阅读理解式智能问答系统等。
17+
18+
* **灵活可定制**:除深度兼容 PaddleNLP 模型组件外,还可嵌入飞桨生态下任意模型、[AI 开放平台算子](https://ai.baidu.com/)、其它开源项目如 Elasticsearch 等作为基础组件,快速扩展,从而实现任意复杂系统的灵活定制开发。
19+
20+
## Benchmarks
21+
22+
<div align="center">
23+
<img src="https://user-images.githubusercontent.com/12107462/187362675-f0818e77-a521-4479-8dd7-bcbf4a820f7d.png" width="500">
24+
</div>
25+
26+
更多的Benchmarks的信息请参考文档[Benchmarks](./benchmarks/README.md)
27+
28+
## NLP流水线系统
29+
30+
PaddleNLP Pipelines NLP流水线系统针对 NLP 部分高频场景开源了经过充分打磨的产品级系统,并会不断开放其它场景的产品级系统,用户可以基于NLP流水线系统提供的系统能力快速开发出适配业务数据的产品。
31+
32+
* 快速搭建产品级[**语义检索**](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines/examples/semantic-search)系统:使用自然语言文本通过语义进行智能文档查询,而不是关键字匹配
33+
* 快速搭建产品级[**智能问答**](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines/examples/question-answering)系统:用自然语言提问,即可获得精准答案片段
34+
* 快速搭建产品级 [**FAQ 问答**](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines/examples/FAQ)系统:用自然语言提问,匹配相关的高频问题,并返回匹配到的高频问题的答案
35+
* 快速搭建产品级**多模态信息抽取**系统(即将开放,敬请期待)
36+
37+
### 效果展示
38+
39+
+ 语义检索
40+
41+
<div align="center">
42+
<img src="https://user-images.githubusercontent.com/12107462/190302765-663ba441-9dd3-470a-8fee-f7a6f81da615.gif" width="500px">
43+
</div>
44+
45+
+ 智能问答
46+
47+
<div align="center">
48+
<img src="https://user-images.githubusercontent.com/12107462/190298926-a1fc92f3-5ec7-4265-8357-ab860cc1fed2.gif" width="500px">
49+
</div>
50+
51+
+ FAQ智能问答
52+
53+
<div align="center">
54+
<img src="https://user-images.githubusercontent.com/12107462/190307449-38135678-f259-4483-ac0f-2fa3ae4be97f.gif" width="500px">
55+
</div>
56+
57+
| | |
58+
|-|-|
59+
| :floppy_disk: [快速安装](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines#floppy_disk-安装) |安装 PaddleNLP Pipelines|
60+
| :beginner: [快速体验](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines#beginner-快速体验) |基于 Pipelines 快速搭建语义检索/智能问答等产品系统|
61+
| :man_office_worker: [用户案例](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines#man_office_worker-用户案例) |各行业用户基于PaddleNLP Pipelinse 构建的产品案例|
62+
| :mortar_board: [Tutorials](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines#mortar_board-tutorials) |像搭积木一样一步步构建 NLP 流水线系统教程|
63+
| :bar_chart: [Benchmarks](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines/benchmarks) |针对各场景模型的性能、精度评测指标|
64+
| :telescope: [Roadmap](https://github.com/PaddlePaddle/PaddleNLP) | PaddleNLP Pipelines 产品路线图|
65+
| :newspaper: [技术博客](https://github.com/PaddlePaddle/PaddleNLP) | 阅读 PaddleNLP Pipelines 系列技术文章|
66+
| :vulcan_salute: [社区交流](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines#vulcan_salute-社区交流) | [官方微信群](https://github.com/PaddlePaddle/PaddleNLP#社区交流), [GitHub Discussions](https://github.com/PaddlePaddle/PaddleNLP/discussions) |
67+
68+
## :floppy_disk: 安装
69+
Note: 因为 pipelines 依赖较多, 安装耗时大概 10 分钟左右,安装过程中请请耐心等待。
70+
### 环境依赖
71+
- python >= 3.7.3
72+
- paddlenlp >= 2.2.1
73+
- paddlepaddle >=2.3
74+
- CUDA Version: 10.2
75+
- NVIDIA Driver Version: 440.64.00
76+
- Docker 18.03 以上
77+
### pip 安装
78+
```
79+
pip install --upgrade paddle-pipelines
80+
```
81+
82+
### 源码安装
83+
```
84+
git clone https://github.com/PaddlePaddle/PaddleNLP.git
85+
cd PaddleNLP/pipelines
86+
python setup.py install
87+
```
88+
89+
## :beginner: 快速体验
90+
91+
### 快速开发
92+
93+
您可以参考如下示例像搭积木一样快速构建语义检索流水线,通过命令行终端输出快速体验流水线系统效果
94+
95+
```python
96+
from pipelines.document_stores import FAISSDocumentStore
97+
from pipelines.nodes import DensePassageRetriever, ErnieRanker
98+
99+
# Step1: Preparing the data
100+
documents = [
101+
{'content': '金钱龟不分品种,只有生长地之分,在我国主要分布于广东、广西、福建、海南、香港、澳门等地,在国外主要分布于越南等亚热带国家和地区。',
102+
'meta': {'name': 'test1.txt'}},
103+
{'content': '衡量酒水的价格的因素很多的,酒水的血统(也就是那里产的,采用什么工艺等);存储的时间等等,酒水是一件很难标准化得商品,只要你敢要价,有买的那就值那个钱。',
104+
'meta': {'name': 'test2.txt'}}
105+
]
106+
107+
# Step2: Initialize a FaissDocumentStore to store texts of documents
108+
document_store = FAISSDocumentStore(embedding_dim=768)
109+
document_store.write_documents(documents)
110+
111+
# Step3: Initialize a DenseRetriever and build ANN index
112+
retriever = DensePassageRetriever(document_store=document_store, query_embedding_model="rocketqa-zh-base-query-encoder",embed_title=False)
113+
document_store.update_embeddings(retriever)
114+
115+
# Step4: Initialize a Ranker
116+
ranker = ErnieRanker(model_name_or_path="rocketqa-base-cross-encoder")
117+
118+
# Step5: Initialize a SemanticSearchPipeline and ask questions
119+
from pipelines import SemanticSearchPipeline
120+
pipeline = SemanticSearchPipeline(retriever, ranker)
121+
prediction = pipeline.run(query="衡量酒水的价格的因素有哪些?")
122+
```
123+
### 快速部署
124+
125+
您可以基于我们发布的 Docker 镜像一键部署智能文本流水线系统,通过 Web UI 快速体验。
126+
127+
#### 启动 elastic search
128+
129+
```
130+
docker network create elastic
131+
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.3.3
132+
docker run \
133+
-d \
134+
--name es02 \
135+
--net elastic \
136+
-p 9200:9200 \
137+
-e discovery.type=single-node \
138+
-e ES_JAVA_OPTS="-Xms256m -Xmx256m"\
139+
-e xpack.security.enabled=false \
140+
-e cluster.routing.allocation.disk.threshold_enabled=false \
141+
-it \
142+
docker.elastic.co/elasticsearch/elasticsearch:8.3.3
143+
```
144+
145+
#### 部署 CPU 服务
146+
147+
对于Linux使用Docker的用户,使用下面的命令:
148+
```
149+
docker pull registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0
150+
docker run -d --name paddlenlp_pipelines --net host -ti registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0
151+
```
152+
对于Windows&Macos上使用Docker的用户,用下面的命令:
153+
154+
```
155+
docker pull registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0.windows.darwin
156+
docker run -d --name paddlenlp_pipelines -p 8891:8891 -p 8502:8502 -ti registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0.windows.darwin
157+
```
158+
CPU 镜像下载大概耗时 10 分钟左右,容器启动成功后,等待3分钟左右,通过浏览器访问 [http://127.0.0.1:8502](http://127.0.0.1:8502) 快速体验产品级语义检索服务。
159+
160+
161+
#### 部署 GPU 服务
162+
```
163+
docker pull registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0-gpu-cuda10.2-cudnn7
164+
nvidia-docker run -d --name paddlenlp_pipelines_gpu --net host -ti registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0-gpu-cuda10.2-cudnn7
165+
```
166+
GPU 镜像下载大概耗时 15 分钟左右,容器启动成功后,等待1分钟左右,通过浏览器访问 [http://127.0.0.1:8502](http://127.0.0.1:8502) 快速体验产品级语义检索服务。
167+
168+
169+
对于国内用户,因为网络问题下载docker比较慢时,可使用百度提供的镜像:
170+
171+
172+
| 环境 | 镜像 Tag | 运行平台 |
173+
| :--------------------------: | :-------------------------------: | :-------------: |
174+
| CPU | registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0 | Linux |
175+
| CPU | registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0.windows.darwin | Windows&Macos |
176+
| CUDA10.2 + cuDNN 7 | registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0-gpu-cuda10.2-cudnn7 | Linux |
177+
| CUDA11.2 + cuDNN 8 | registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0-gpu-cuda11.2-cudnn8 | Linux |
178+
179+
如果您的机器不在中国大陆地区,我们推荐您使用DockerHub的镜像:
180+
181+
| 环境 | 镜像 Tag | 运行平台 |
182+
| :--------------------------: | :-------------------------------: | :-------------: |
183+
| CPU | paddlepaddle/paddlenlp:2.4.0 | Linux |
184+
| CPU | paddlepaddle/paddlenlp:2.4.0.windows.darwin | Windows&Macos |
185+
| CUDA10.2 + cuDNN 7 | paddlepaddle/paddlenlp:2.4.0-gpu-cuda10.2-cudnn7 | Linux |
186+
| CUDA11.2 + cuDNN 8 | paddlepaddle/paddlenlp:2.4.0-gpu-cuda11.2-cudnn8 | Linux |
187+
188+
对于智能问答应用,请参考Docker文档[docker文档](./docker/README.md),只需做少量的修改,就可以完成智能问答应用的部署。
189+
190+
#### REST API
191+
192+
Pipelines可以服务化,通过HTTP接口的形式供其他程序进行调用,Pipelines提供了Swagger API方便用户查询接口文档,从而把Pipelines的能力接入到自己的应用系统中,只需要在启动REST API后通过浏览器访问 [http://127.0.0.1:8891/docs](http://127.0.0.1:8891/docs)
193+
194+
<div align="center">
195+
<img src="https://user-images.githubusercontent.com/12107462/204282574-4a468ba5-d32f-4ead-970b-87139b613521.png" width="500px">
196+
</div>
197+
198+
199+
## :man_office_worker: 用户案例
200+
201+
### 案例1: [寻规-工程规范搜索引擎](https://xungui365.com/)
202+
203+
[寻规](https://xungui365.com/),是一款基于飞桨 PaddleNLP Pipelines 构建的建筑工程规范搜索引擎。大幅提升了工程设计人员工作效率。
204+
205+
#### 查询效率提升 36~60 倍
206+
207+
相比市面当前的工程规范查询系统/网站,平均查询到一条规范条款要 3\~5 分钟,而基于 PaddleNLP Pipelines 构建的[寻规](https://xungui365.com/)检索系统,平均查询到一条规范条款仅需 5 秒左右,搜索时间大幅缩短,仅规范查询效率方面就提升**36\~60** 倍!
208+
209+
#### 查询精度大幅提升
210+
211+
市面现已有的工程规范查询系统解决方案一直延续着传统关键字词匹配的查询方式,依赖用户对查询结果进行自行排序、筛选、鉴别,有时甚至还要再次由工程设计人员耗费一定时间精力人工查阅工程规范文件后,才能最终确认是否为想要查询的规范条款。传统规范查询系统至少需要进行 3~5 次查询才能找到用户想要的规范条款,而寻规系统是基于强大预训练模型构建起来的语义检索系统,针对 80% 的规范查询需求仅 **1 次查询** 就能精确命中查询意图,并返回真正符合工程设计人员查询意图的结果!
212+
213+
## :mortar_board: Tutorials
214+
- Tutorial 1 - Pipelines [Windows视频安装教程](https://www.bilibili.com/video/BV1DY4y1M7HE/?zw)
215+
- Tutorial 2 - 语义检索 Pipeline: [AIStudio notebook](https://aistudio.baidu.com/aistudio/projectdetail/4442670) | [Python](https://github.com/PaddlePaddle/PaddleNLP/blob/develop/pipelines/examples/semantic-search/semantic_search_example.py)
216+
- Tutorial 3 - 智能问答 Pipeline: [AIStudio notebook](https://aistudio.baidu.com/aistudio/projectdetail/4442857) | [Python](https://github.com/PaddlePaddle/PaddleNLP/blob/develop/pipelines/examples/question-answering/dense_qa_example.py)
217+
- Tutorial 4 - FAQ智能问答 Pipeline: [AIStudio notebook](https://aistudio.baidu.com/aistudio/projectdetail/4465498) | [Python](https://github.com/PaddlePaddle/PaddleNLP/blob/develop/pipelines/examples/FAQ/dense_faq_example.py)
218+
- Tutorial 5 - Pipelines 快速上手二次开发教程: [AIStudio notebook](https://aistudio.baidu.com/aistudio/projectdetail/5011119)
219+
## :vulcan_salute: 社区交流
220+
微信扫描二维码并填写问卷之后,加入交流群与来自各行各业的小伙伴交流学习吧~
221+
<div align="center">
222+
<img src="https://user-images.githubusercontent.com/11793384/168411900-d9f3d777-99ab-4b5c-8cdc-ef747a48b864.jpg" width="150" height="150" />
223+
</div>
224+
225+
226+
## :heart: Acknowledge
227+
我们借鉴了 Deepset.ai [Haystack](https://github.com/deepset-ai/haystack) 优秀的框架设计,在此对[Haystack](https://github.com/deepset-ai/haystack)作者及其开源社区表示感谢。
228+
229+
We learn form the excellent framework design of Deepset.ai [Haystack](https://github.com/deepset-ai/haystack), and we would like to express our thanks to the authors of Haystack and their open source community.

0 commit comments

Comments
 (0)