Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9192cd8

Browse files
committed
first commit without legacy files
1 parent cc1d27e commit 9192cd8

302 files changed

Lines changed: 78404 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
.hypothesis/
50+
.pytest_cache/
51+
52+
# Translations
53+
*.mo
54+
*.pot
55+
56+
# Django stuff:
57+
*.log
58+
local_settings.py
59+
db.sqlite3
60+
61+
# Flask stuff:
62+
instance/
63+
.webassets-cache
64+
65+
# Scrapy stuff:
66+
.scrapy
67+
68+
# Sphinx documentation
69+
docs/_build/
70+
71+
# PyBuilder
72+
target/
73+
74+
# Jupyter Notebook
75+
.ipynb_checkpoints
76+
77+
# IPython
78+
profile_default/
79+
ipython_config.py
80+
81+
# pyenv
82+
.python-version
83+
84+
# celery beat schedule file
85+
celerybeat-schedule
86+
87+
# SageMath parsed files
88+
*.sage.py
89+
90+
# Environments
91+
.env
92+
.venv
93+
env/
94+
venv/
95+
ENV/
96+
env.bak/
97+
venv.bak/
98+
99+
# Spyder project settings
100+
.spyderproject
101+
.spyproject
102+
103+
# Rope project settings
104+
.ropeproject
105+
106+
# mkdocs documentation
107+
/site
108+
109+
# mypy
110+
.mypy_cache/
111+
.dmypy.json
112+
dmypy.json
113+
114+
# Pyre type checker
115+
.pyre/
116+
117+
# pycharm
118+
.DS_Store
119+
.idea/
120+
FETCH_HEAD
121+
122+
# vscode
123+
.vscode

.pre-commit-config.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
- repo: https://github.com/PaddlePaddle/mirrors-yapf.git
2+
sha: 0d79c0c469bab64f7229c9aca2b1186ef47f0e37
3+
hooks:
4+
- id: yapf
5+
files: \.py$
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
sha: a11d9314b22d8f8c7556443875b731ef05965464
8+
hooks:
9+
- id: check-merge-conflict
10+
- id: check-symlinks
11+
- id: detect-private-key
12+
files: (?!.*paddle)^.*$
13+
- id: end-of-file-fixer
14+
files: \.md$
15+
- id: trailing-whitespace
16+
files: \.md$
17+
- repo: https://github.com/Lucas-C/pre-commit-hooks
18+
sha: v1.0.1
19+
hooks:
20+
- id: forbid-crlf
21+
files: \.md$
22+
- id: remove-crlf
23+
files: \.md$
24+
- id: forbid-tabs
25+
files: \.md$
26+
- id: remove-tabs
27+
files: \.md$
28+
- repo: local
29+
hooks:
30+
- id: clang-format
31+
name: clang-format
32+
description: Format files with ClangFormat
33+
entry: bash .clang_format.hook -i
34+
language: system
35+
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$

.style.yapf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[style]
2+
based_on_style = pep8
3+
column_limit = 80

LICENSE

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved
2+
13
Apache License
24
Version 2.0, January 2004
35
http://www.apache.org/licenses/
@@ -186,7 +188,7 @@
186188
same "printed page" as the copyright notice for easier
187189
identification within third-party archives.
188190

189-
Copyright [yyyy] [name of copyright owner]
191+
Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
190192

191193
Licensed under the Apache License, Version 2.0 (the "License");
192194
you may not use this file except in compliance with the License.

README.md

Lines changed: 141 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,141 @@
1-
# PaddleNLP
1+
简体中文 | [English](./README_en.md)
2+
3+
<p align="center">
4+
<img src="./docs/imgs/paddlenlp.png" width="520" height ="100" />
5+
</p>
6+
7+
------------------------------------------------------------------------------------------
8+
9+
![License](https://img.shields.io/badge/license-Apache%202-red.svg)
10+
![python version](https://img.shields.io/badge/python-3.6+-orange.svg)
11+
![support os](https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-yellow.svg)
12+
13+
## 简介
14+
15+
PaddleNLP 2.0拥有丰富的模型库、简洁易用的API与高性能的分布式训练的能力,旨在为飞桨开发者提升文本建模效率,并提供基于PaddlePaddle 2.0的NLP领域最佳实践。
16+
17+
## 特性
18+
19+
- **丰富的模型库**
20+
- 涵盖了NLP主流应用相关的前沿模型,包括中文词向量、预训练模型、词法分析、文本分类、文本匹配、文本生成、机器翻译、通用对话、问答系统等,更多详细介绍请查看[PaddleNLP模型库](./docs/model_zoo.md)
21+
22+
- **简洁易用的API**
23+
- 深度兼容飞桨2.0的高层API体系,提供可复用的文本建模模块,可大幅度减少数据处理、组网、训练环节的代码开发量,提升文本建模开发效率。
24+
25+
- **高性能分布式训练**
26+
- 通过深度优化的混合精度训练策略与Fleet分布式训练API,可充分利用GPU集群资源,高效完成大规模预训练模型的分布式训练。
27+
28+
29+
## 安装
30+
31+
### 环境依赖
32+
33+
- python >= 3.6
34+
- paddlepaddle >= 2.0.0
35+
36+
```
37+
pip install paddlenlp==2.0.0rc
38+
```
39+
40+
## 快速开始
41+
42+
### 数据集快速加载
43+
44+
```python
45+
from paddlenlp.datasets import ChnSentiCorp
46+
47+
train_ds, dev_ds, test_ds = ChnSentiCorp.get_datasets(['train', 'dev', 'test'])
48+
```
49+
50+
可参考[Dataset文档](./docs/datasets.md)查看更多数据集。
51+
52+
### 一键加载中文词向量
53+
54+
```python
55+
from paddlenlp.embeddings import TokenEmbedding
56+
57+
wordemb = TokenEmbedding("w2v.baidu_encyclopedia.target.word-word.dim300")
58+
print(wordemb.cosine_sim("国王", "王后"))
59+
>>> 0.63395125
60+
wordemb.cosine_sim("艺术", "火车")
61+
>>> 0.14792643
62+
```
63+
64+
内置50+中文词向量,更多使用方法请参考 [Embedding文档](./examples/word_embedding/README.md)
65+
66+
67+
### 一键加载高质量中文预训练模型
68+
69+
```python
70+
from paddlenlp.transformers import ErnieModel, BertModel, RobertaModel, ElectraModel, GPT2ForPretraining
71+
72+
ernie = ErnieModel.from_pretrained('ernie-1.0')
73+
bert = BertModel.from_pretrained('bert-wwm-chinese')
74+
roberta = RobertaModel.from_pretrained('roberta-wwm-ext')
75+
electra = ElectraModel.from_pretrained('chinese-electra-small')
76+
gpt2 = GPT2ForPretraining.from_pretrained('gpt2-base-cn')
77+
```
78+
79+
请参考 [Pretrained-Models](./docs/transformers.md)查看目前支持的预训练模型。
80+
81+
## 模型库及其应用
82+
83+
PaddleNLP模型库整体介绍请参考文档[PaddleNLP Model Zoo](./docs/model_zoo.md).
84+
模型应用场景介绍请参考[PaddleNLP Examples](./examples/README.md)
85+
86+
- [词向量](./examples/word_embedding/README.md)
87+
- [词法分析](./examples/lexical_analysis/README.md)
88+
- [语言模型](./examples/language_model)
89+
- [文本分类](./examples/text_classification/README.md)
90+
- [文本生成](./examples/text_generation/README.md)
91+
- [语义匹配](./examples/text_matching/README.md)
92+
- [命名实体识别](./examples/named_entity_recognition/README.md)
93+
- [文本图学习](./examples/text_graph/erniesage/README.md)
94+
- [通用对话](./examples/dialogue)
95+
- [机器翻译](./examples/machine_translation)
96+
- [阅读理解](./examples/machine_reading_comprehension)
97+
98+
## 进阶应用
99+
100+
- [模型压缩](./examples/model_compression/)
101+
102+
## API 使用文档
103+
104+
- [Transformer API](./docs/transformers.md)
105+
* 基于Transformer结构相关的预训练模型API,包含ERNIE, BERT, RoBERTa, Electra等主流经典结构和下游任务。
106+
- [Data API](./docs/data.md)
107+
* 文本数据处理Pipeline的相关API说明。
108+
- [Dataset API](./docs/datasets.md)
109+
* 数据集相关API,包含自定义数据集,数据集贡献与数据集快速加载等功能说明。
110+
- [Embedding API](./docs/embeddings.md)
111+
* 词向量相关API,支持一键快速加载包预训练的中文词向量,VisulDL高维可视化等功能说明。
112+
- [Metrics API](./docs/metrics.md)
113+
* 针对NLP场景的评估指标说明,与飞桨2.0框架高层API兼容。
114+
115+
116+
## 交互式Notebook教程
117+
118+
- [使用Seq2Vec模块进行句子情感分类](https://aistudio.baidu.com/aistudio/projectdetail/1283423)
119+
- [如何通过预训练模型Fine-tune下游任务](https://aistudio.baidu.com/aistudio/projectdetail/1294333)
120+
- [使用BiGRU-CRF模型完成快递单信息抽取](https://aistudio.baidu.com/aistudio/projectdetail/1317771)
121+
- [使用预训练模型ERNIE优化快递单信息抽取](https://aistudio.baidu.com/aistudio/projectdetail/1329361)
122+
- [使用Seq2Seq模型完成自动对联](https://aistudio.baidu.com/aistudio/projectdetail/1321118)
123+
- [使用预训练模型ERNIE-GEN实现智能写诗](https://aistudio.baidu.com/aistudio/projectdetail/1339888)
124+
- [使用TCN网络完成新冠疫情病例数预测](https://aistudio.baidu.com/aistudio/projectdetail/1290873)
125+
126+
更多教程参见[PaddleNLP on AI Studio](https://aistudio.baidu.com/aistudio/personalcenter/thirdview/574995)
127+
128+
129+
## 社区贡献与技术交流
130+
131+
- 欢迎您加入PaddleNLP的SIG社区,贡献优秀的模型实现、公开数据集、教程与案例、外围小工具。
132+
- 现在就加入PaddleNLP的QQ技术交流群,一起交流NLP技术吧!⬇️
133+
134+
<div align="center">
135+
<img src="./docs/imgs/qq.png" width="200" height="200" />
136+
</div>
137+
138+
139+
## License
140+
141+
PaddleNLP遵循[Apache-2.0开源协议](./LICENSE)

0 commit comments

Comments
 (0)