Skip to content

Commit 1ffa290

Browse files
authored
[paddle-pipelines] Update mkdocs (#8310)
* Update mkdocs * Update mkdocs configuration * migrate paths * change root path * try to fix * revert * Update memory.md * restore agent.md path * fix path error * Add index.md * Update README.md * Update README.md
1 parent eaca5b2 commit 1ffa290

24 files changed

+298
-52
lines changed

pipelines/.readthedocs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ build:
1212
python: "3.12"
1313

1414
mkdocs:
15-
configuration: mkdocs.yml
15+
configuration: pipelines/mkdocs.yml
1616

1717
# Optionally declare the Python requirements required to build your docs
1818
python:
1919
install:
20-
- requirements: docs/requirements.txt
20+
- requirements: pipelines/docs/requirements.txt

pipelines/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ PaddleNLP Pipelines NLP流水线系统针对 NLP 部分高频场景开源了经
3232
* 快速搭建产品级[**语义检索**](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines/examples/semantic-search)系统:使用自然语言文本通过语义进行智能文档查询,而不是关键字匹配
3333
* 快速搭建产品级[**智能问答**](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines/examples/question-answering)系统:用自然语言提问,即可获得精准答案片段
3434
* 快速搭建产品级 [**FAQ 问答**](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines/examples/FAQ)系统:用自然语言提问,匹配相关的高频问题,并返回匹配到的高频问题的答案
35-
* 快速搭建产品级**多模态信息抽取**系统(即将开放,敬请期待)
3635

3736
### 效果展示
3837

@@ -120,6 +119,8 @@ from pipelines import SemanticSearchPipeline
120119
pipeline = SemanticSearchPipeline(retriever, ranker)
121120
prediction = pipeline.run(query="衡量酒水的价格的因素有哪些?")
122121
```
122+
更多详细信息请参考[开发文档](https://paddle-pipelines.readthedocs.io/en/latest/)
123+
123124
### 快速部署
124125

125126
您可以基于我们发布的 Docker 镜像一键部署智能文本流水线系统,通过 Web UI 快速体验。

pipelines/docs/index.md

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
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+
12+
## NLP流水线系统特色
13+
* **全场景支持**:依托灵活的插拔式组件产线化设计,支持各类 NLP 场景任务,包括:信息抽取、情感倾向分析、阅读理解、检索系统、问答系统、文本分类、文本生成等。
14+
15+
* **低门槛开发**:依托丰富的预置组件,像搭积木一样快速构建产品级系统,预置组件覆盖文档解析、数据处理、模型组网、预测部署、Web 服务、UI 界面等全流程系统功能。
16+
17+
* **高精度预测**:基于前沿的预训练模型、成熟的系统方案,可构建效果领先的产品级系统,如[NLP流水线系统](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines#NLP流水线系统)中预置的语义检索系统、阅读理解式智能问答系统等。
18+
19+
* **灵活可定制**:除深度兼容 PaddleNLP 模型组件外,还可嵌入飞桨生态下任意模型、[AI 开放平台算子](https://ai.baidu.com/)、其它开源项目如 Elasticsearch 等作为基础组件,快速扩展,从而实现任意复杂系统的灵活定制开发。
20+
21+
## Benchmarks
22+
23+
<div align="center">
24+
<img src="https://user-images.githubusercontent.com/12107462/187362675-f0818e77-a521-4479-8dd7-bcbf4a820f7d.png" width="500">
25+
</div>
26+
27+
更多的Benchmarks的信息请参考文档[Benchmarks](./benchmarks/README.md)
28+
29+
## NLP流水线系统
30+
31+
PaddleNLP Pipelines NLP流水线系统针对 NLP 部分高频场景开源了经过充分打磨的产品级系统,并会不断开放其它场景的产品级系统,用户可以基于NLP流水线系统提供的系统能力快速开发出适配业务数据的产品。
32+
33+
* 快速搭建产品级[**语义检索**](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines/examples/semantic-search)系统:使用自然语言文本通过语义进行智能文档查询,而不是关键字匹配
34+
* 快速搭建产品级[**智能问答**](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines/examples/question-answering)系统:用自然语言提问,即可获得精准答案片段
35+
* 快速搭建产品级 [**FAQ 问答**](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/pipelines/examples/FAQ)系统:用自然语言提问,匹配相关的高频问题,并返回匹配到的高频问题的答案
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+
126+
您可以基于我们发布的 Docker 镜像一键部署智能文本流水线系统,通过 Web UI 快速体验。
127+
128+
#### 启动 elastic search
129+
130+
```
131+
docker network create elastic
132+
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.3.3
133+
docker run \
134+
-d \
135+
--name es02 \
136+
--net elastic \
137+
-p 9200:9200 \
138+
-e discovery.type=single-node \
139+
-e ES_JAVA_OPTS="-Xms256m -Xmx256m"\
140+
-e xpack.security.enabled=false \
141+
-e cluster.routing.allocation.disk.threshold_enabled=false \
142+
-it \
143+
docker.elastic.co/elasticsearch/elasticsearch:8.3.3
144+
```
145+
146+
#### 部署 CPU 服务
147+
148+
对于Linux使用Docker的用户,使用下面的命令:
149+
```
150+
docker pull registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0
151+
docker run -d --name paddlenlp_pipelines --net host -ti registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0
152+
```
153+
对于Windows&Macos上使用Docker的用户,用下面的命令:
154+
155+
```
156+
docker pull registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0.windows.darwin
157+
docker run -d --name paddlenlp_pipelines -p 8891:8891 -p 8502:8502 -ti registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0.windows.darwin
158+
```
159+
CPU 镜像下载大概耗时 10 分钟左右,容器启动成功后,等待3分钟左右,通过浏览器访问 [http://127.0.0.1:8502](http://127.0.0.1:8502) 快速体验产品级语义检索服务。
160+
161+
162+
#### 部署 GPU 服务
163+
```
164+
docker pull registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0-gpu-cuda10.2-cudnn7
165+
nvidia-docker run -d --name paddlenlp_pipelines_gpu --net host -ti registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0-gpu-cuda10.2-cudnn7
166+
```
167+
GPU 镜像下载大概耗时 15 分钟左右,容器启动成功后,等待1分钟左右,通过浏览器访问 [http://127.0.0.1:8502](http://127.0.0.1:8502) 快速体验产品级语义检索服务。
168+
169+
170+
对于国内用户,因为网络问题下载docker比较慢时,可使用百度提供的镜像:
171+
172+
173+
| 环境 | 镜像 Tag | 运行平台 |
174+
| :--------------------------: | :-------------------------------: | :-------------: |
175+
| CPU | registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0 | Linux |
176+
| CPU | registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0.windows.darwin | Windows&Macos |
177+
| CUDA10.2 + cuDNN 7 | registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0-gpu-cuda10.2-cudnn7 | Linux |
178+
| CUDA11.2 + cuDNN 8 | registry.baidubce.com/paddlepaddle/paddlenlp:2.4.0-gpu-cuda11.2-cudnn8 | Linux |
179+
180+
如果您的机器不在中国大陆地区,我们推荐您使用DockerHub的镜像:
181+
182+
| 环境 | 镜像 Tag | 运行平台 |
183+
| :--------------------------: | :-------------------------------: | :-------------: |
184+
| CPU | paddlepaddle/paddlenlp:2.4.0 | Linux |
185+
| CPU | paddlepaddle/paddlenlp:2.4.0.windows.darwin | Windows&Macos |
186+
| CUDA10.2 + cuDNN 7 | paddlepaddle/paddlenlp:2.4.0-gpu-cuda10.2-cudnn7 | Linux |
187+
| CUDA11.2 + cuDNN 8 | paddlepaddle/paddlenlp:2.4.0-gpu-cuda11.2-cudnn8 | Linux |
188+
189+
对于智能问答应用,请参考Docker文档[docker文档](./docker/README.md),只需做少量的修改,就可以完成智能问答应用的部署。
190+
191+
#### REST API
192+
193+
Pipelines可以服务化,通过HTTP接口的形式供其他程序进行调用,Pipelines提供了Swagger API方便用户查询接口文档,从而把Pipelines的能力接入到自己的应用系统中,只需要在启动REST API后通过浏览器访问 [http://127.0.0.1:8891/docs](http://127.0.0.1:8891/docs)
194+
195+
<div align="center">
196+
<img src="https://user-images.githubusercontent.com/12107462/204282574-4a468ba5-d32f-4ead-970b-87139b613521.png" width="500px">
197+
</div>
198+
199+
200+
## :man_office_worker: 用户案例
201+
202+
### 案例1: [寻规-工程规范搜索引擎](https://xungui365.com/)
203+
204+
[寻规](https://xungui365.com/),是一款基于飞桨 PaddleNLP Pipelines 构建的建筑工程规范搜索引擎。大幅提升了工程设计人员工作效率。
205+
206+
#### 查询效率提升 36~60 倍
207+
208+
相比市面当前的工程规范查询系统/网站,平均查询到一条规范条款要 3\~5 分钟,而基于 PaddleNLP Pipelines 构建的[寻规](https://xungui365.com/)检索系统,平均查询到一条规范条款仅需 5 秒左右,搜索时间大幅缩短,仅规范查询效率方面就提升**36\~60** 倍!
209+
210+
#### 查询精度大幅提升
211+
212+
市面现已有的工程规范查询系统解决方案一直延续着传统关键字词匹配的查询方式,依赖用户对查询结果进行自行排序、筛选、鉴别,有时甚至还要再次由工程设计人员耗费一定时间精力人工查阅工程规范文件后,才能最终确认是否为想要查询的规范条款。传统规范查询系统至少需要进行 3~5 次查询才能找到用户想要的规范条款,而寻规系统是基于强大预训练模型构建起来的语义检索系统,针对 80% 的规范查询需求仅 **1 次查询** 就能精确命中查询意图,并返回真正符合工程设计人员查询意图的结果!
213+
214+
## :mortar_board: Tutorials
215+
- Tutorial 1 - Pipelines [Windows视频安装教程](https://www.bilibili.com/video/BV1DY4y1M7HE/?zw)
216+
- 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)
217+
- 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)
218+
- 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)
219+
- Tutorial 5 - Pipelines 快速上手二次开发教程: [AIStudio notebook](https://aistudio.baidu.com/aistudio/projectdetail/5011119)
220+
## :vulcan_salute: 社区交流
221+
微信扫描二维码并填写问卷之后,加入交流群与来自各行各业的小伙伴交流学习吧~
222+
<div align="center">
223+
<img src="https://user-images.githubusercontent.com/11793384/168411900-d9f3d777-99ab-4b5c-8cdc-ef747a48b864.jpg" width="150" height="150" />
224+
</div>
225+
226+
227+
## :heart: Acknowledge
228+
我们借鉴了 Deepset.ai [Haystack](https://github.com/deepset-ai/haystack) 优秀的框架设计,在此对[Haystack](https://github.com/deepset-ai/haystack)作者及其开源社区表示感谢。
229+
230+
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.

pipelines/docs/package/agents/agents.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Agent Module
22

3-
::: pipelines.agents.base
3+
::: pipelines.pipelines.agents.base
44
options:
55
summary: true
66
separate_signature: true
@@ -12,7 +12,7 @@
1212
- Tool
1313

1414

15-
::: pipelines.agents.agent_step
15+
::: pipelines.pipelines.agents.agent_step
1616
options:
1717
summary: true
1818
separate_signature: true
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Memory Module
2+
3+
::: pipelines.pipelines.agents.memory.conversation_memory
4+
options:
5+
summary: true
6+
separate_signature: true
7+
show_signature_annotations: true
8+
line_length: 60
9+
10+
::: pipelines.pipelines.agents.memory.no_memory
11+
options:
12+
summary: true
13+
separate_signature: true
14+
show_signature_annotations: true
15+
line_length: 60

pipelines/docs/package/docstore/elasticsearch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Elasticsearch Module
22

3-
::: pipelines.document_stores.elasticsearch
3+
::: pipelines.pipelines.document_stores.elasticsearch
44
options:
55
summary: true
66
separate_signature: true

pipelines/docs/package/docstore/faiss.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# FAISS Module
22

3-
::: pipelines.document_stores.faiss
3+
::: pipelines.pipelines.document_stores.faiss
44
options:
55
summary: true
66
separate_signature: true

pipelines/docs/package/docstore/milvus2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Milvus2 Module
22

3-
::: pipelines.document_stores.milvus2
3+
::: pipelines.pipelines.document_stores.milvus2
44
options:
55
summary: true
66
separate_signature: true

pipelines/docs/package/nodes/answer_extractor.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
# Answer Extractor Module
22

3-
::: pipelines.nodes.answer_extractor.answer_extractor_preprocessor
3+
::: pipelines.pipelines.nodes.answer_extractor.answer_extractor_preprocessor
44
options:
55
summary: true
66
separate_signature: true
77
show_signature_annotations: true
88
line_length: 60
99

10-
::: pipelines.nodes.answer_extractor.answer_extractor
10+
::: pipelines.pipelines.nodes.answer_extractor.answer_extractor
1111
options:
1212
summary: true
1313
separate_signature: true
1414
show_signature_annotations: true
1515
line_length: 60
1616

17-
::: pipelines.nodes.answer_extractor.qa_filter_postprocessor
17+
::: pipelines.pipelines.nodes.answer_extractor.qa_filter_postprocessor
1818
options:
1919
summary: true
2020
separate_signature: true
2121
show_signature_annotations: true
2222
line_length: 60
2323

24-
::: pipelines.nodes.answer_extractor.qa_filter
24+
::: pipelines.pipelines.nodes.answer_extractor.qa_filter
2525
options:
2626
summary: true
2727
separate_signature: true

pipelines/docs/package/nodes/document_intelligence.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Document Intelligence Module
22

3-
::: pipelines.nodes.document.document_intelligence
3+
::: pipelines.pipelines.nodes.document.document_intelligence
44
options:
55
summary: true
66
separate_signature: true
77
show_signature_annotations: true
88
line_length: 60
99

10-
::: pipelines.nodes.document.document_preprocessor
10+
::: pipelines.pipelines.nodes.document.document_preprocessor
1111
options:
1212
summary: true
1313
separate_signature: true

0 commit comments

Comments
 (0)