GithubHelp home page GithubHelp logo

drickv5 / paddlenlp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from paddlepaddle/paddlenlp

0.0 0.0 0.0 69.77 MB

Easy-to-use and Fast NLP library with awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications. Including Neural Search, Question Answering, Information Extraction and Sentiment Analysis end-to-end system.

Home Page: https://paddlenlp.readthedocs.io

License: Apache License 2.0

Shell 1.91% C++ 10.23% Python 81.87% C 0.03% Cuda 5.10% Makefile 0.02% CMake 0.83% Dockerfile 0.01%

paddlenlp's Introduction

简体中文 | English


News

  • 🔥 2022.5.18-19直播课,解读通用信息抽取技术UIEERNIE 3.0轻量级模型能力,欢迎报名来交流

  • 🔥 2022.5.16 PaddleNLP v2.3全新发布!🎉

    • 开源文心大模型 ERNIE 3.0轻量级模型,在CLUE Benchmark上实现同规模模型中文最佳效果;新增中文医疗领域预训练模型 ERNIE-Health;新增大规模百亿开放域对话预训练模型 PLATO-XL (11B),并提供FasterGeneration高性能并行GPU加速⚡。
    • 通用信息抽取技术 UIE发布,单个模型可以同时支持命名实体识别、关系抽取、事件抽取、情感分析等任务;
  • 2022.12.12 PaddleNLP v2.2发布!新增开箱即用的NLP能力Taskflow!配套语义检索、智能问答、评论观点抽取产业案例,快速搭建端到端NLP系统!配套视频课程直通车

特性

PaddleNLP是飞桨自然语言处理开发库,旨在提升开发者在文本领域的开发效率,并提供丰富的NLP应用示例。具备以下四大特性:

开箱即用的NLP能力

Taskflow提供丰富的开箱即用的产业级NLP预置模型,覆盖自然语言理解与生成两大场景,提供产业级的效果极致的推理性能

taskflow1

更多使用方法可参考Taskflow文档

丰富完备的中文模型库

业界最全的中文预训练模型

精选 45+ 个网络结构和 500+ 个预训练模型参数,涵盖业界最全的中文预训练模型,既包括文心NLP大模型的ERNIE、PLATO等,也覆盖BERT、GPT、RoBERTa、T5等主流结构。通过AutoModel API一键⚡高速下载⚡。

from paddlenlp.transformers import *

ernie = AutoModel.from_pretrained('ernie-3.0-base-zh')
bert = AutoModel.from_pretrained('bert-wwm-chinese')
albert = AutoModel.from_pretrained('albert-chinese-tiny')
roberta = AutoModel.from_pretrained('roberta-wwm-ext')
electra = AutoModel.from_pretrained('chinese-electra-small')
gpt = AutoModelForPretraining.from_pretrained('gpt-cpm-large-cn')

对预训练模型应用范式如语义表示、文本分类、句对匹配、序列标注、问答等,提供统一的API体验。

import paddle
from paddlenlp.transformers import *

tokenizer = AutoTokenizer.from_pretrained('ernie-3.0-medium-zh')
text = tokenizer('自然语言处理')

# 语义表示
model = AutoModel.from_pretrained('ernie-3.0-medium-zh')
sequence_output, pooled_output = model(input_ids=paddle.to_tensor([text['input_ids']]))
# 文本分类 & 句对匹配
model = AutoModelForSequenceClassification.from_pretrained('ernie-3.0-medium-zh')
# 序列标注
model = AutoModelForTokenClassification.from_pretrained('ernie-3.0-medium-zh')
# 问答
model = AutoModelForQuestionAnswering.from_pretrained('ernie-3.0-medium-zh')
 PaddleNLP预训练模型适用任务汇总(点击展开详情)
Model Sequence Classification Token Classification Question Answering Text Generation Multiple Choice
ALBERT
BART
BERT
BigBird
BlenderBot
ChineseBERT
ConvBERT
CTRL
DistilBERT
ELECTRA
ERNIE
ERNIE-CTM
ERNIE-Doc
ERNIE-GEN
ERNIE-Gram
ERNIE-M
FNet
Funnel-Transformer
GPT
LayoutLM
LayoutLMv2
LayoutXLM
LUKE
mBART
MegatronBERT
MobileBERT
MPNet
NEZHA
PP-MiniLM
ProphetNet
Reformer
RemBERT
RoBERTa
RoFormer
SKEP
SqueezeBERT
T5
TinyBERT
UnifiedTransformer
XLNet

可参考Transformer 文档 查看目前支持的预训练模型结构、参数和详细用法。

全场景覆盖的应用示例

覆盖从学术到产业的NLP应用示例,涵盖NLP基础技术、NLP系统应用以及拓展应用。全面基于飞桨核心框架2.0全新API体系开发,为开发者提供飞桨文本领域的最佳实践。

精选预训练模型示例可参考Model Zoo,更多场景示例文档可参考examples目录。更有免费算力支持的AI Studio平台的Notbook交互式教程提供实践。

产业级端到端系统范例

PaddleNLP针对信息抽取、语义检索、智能问答、情感分析等高频NLP场景,提供了端到端系统范例,打通数据标注-模型训练-模型调优-预测部署全流程,持续降低NLP技术产业落地门槛。更多详细的系统级产业范例使用说明请参考Applications

智能语音指令解析

集成了业界领先的语音识别(Automatic Speech Recognition, ASR)、信息抽取(Information Extraction, IE)等技术,打造智能一体化的语音指令系统,广泛应用于智能语音填单、智能语音交互、智能语音检索、手机APP语音唤醒等场景,提高人机交互效率。

更多使用说明请参考智能语音指令解析

语义检索系统

针对无监督数据、有监督数据等多种数据情况,结合SimCSE、In-batch Negatives、ERNIE-Gram单塔模型等,推出前沿的语义检索方案,包含召回、排序环节,打通训练、调优、高效向量检索引擎建库和查询全流程。

更多使用说明请参考语义检索系统

智能问答系统

推出基于语义检索技术的问答系统,支持FAQ问答、说明书问答等多种业务场景。

更多使用说明请参考智能问答系统

评论观点抽取与情感分析

基于情感知识增强预训练模型SKEP,针对产品评论进行评价维度和观点抽取,以及细粒度的情感分析。

更多使用说明请参考情感分析

高性能分布式训练与推理

飞桨4D混合并行分布式训练技术

更多关于千亿级AI模型的分布式训练使用说明可参考GPT-3

FasterTokenizers:高性能文本处理库⚡

针对预训练模型的高性能C++ Tokenizer实现,更多使用说明可参考FasterTokenizers文档

FasterGeneration:高性能生成加速组件⚡

针对大模型生成的加速利器,更多使用说明可参考FasterGeneration文档

社区交流👬

  • 微信扫描二维码并填写问卷之后,加入交流群领取福利

    • 获取5月18-19日每晚20:30《产业级通用信息抽取技术UIE+ERNIE轻量级模型》直播课链接
    • 10G重磅NLP学习大礼包:

安装

环境依赖

  • python >= 3.6
  • paddlepaddle >= 2.2

pip安装

pip install --upgrade paddlenlp

更多关于PaddlePaddle和PaddleNLP安装的详细教程请查看Installation

QuickStart

这里以信息抽取-命名实体识别任务,UIE模型为例,来说明如何快速使用PaddleNLP:

  • 一键预测

PaddleNLP提供一键预测功能,无需训练,直接输入数据,即可得到预测结果:

>>> from pprint import pprint
>>> from paddlenlp import Taskflow

>>> schema = ['时间', '选手', '赛事名称'] # Define the schema for entity extraction
>>> ie = Taskflow('information_extraction', schema=schema)
>>> pprint(ie("2月8日上午北京冬奥会自由式滑雪女子大跳台决赛中**选手谷爱凌以188.25分获得金牌!"))
[{'时间': [{'end': 6,
          'probability': 0.9857378532924486,
          'start': 0,
          'text': '2月8日上午'}],
  '赛事名称': [{'end': 23,
            'probability': 0.8503089953268272,
            'start': 6,
            'text': '北京冬奥会自由式滑雪女子大跳台决赛'}],
  '选手': [{'end': 31,
          'probability': 0.8981548639781138,
          'start': 28,
          'text': '谷爱凌'}]}]
  • 定制训练

如果对一键预测效果不满意,也可以使用少量数据进行模型微调,进一步提升模型在特定场景的效果,详见UIE小样本定制训练

更多内容可参考:多场景示例PaddleNLP on AI Studio

API文档

PaddleNLP提供全流程的文本领域API,可大幅提升NLP任务建模的效率:

更多使用方法请参考API文档

Citation

如果PaddleNLP对您的研究有帮助,欢迎引用

@misc{=paddlenlp,
    title={PaddleNLP: An Easy-to-use and High Performance NLP Library},
    author={PaddleNLP Contributors},
    howpublished = {\url{https://github.com/PaddlePaddle/PaddleNLP}},
    year={2021}
}

Acknowledge

我们借鉴了Hugging Face的Transformers🤗关于预训练模型使用的优秀设计,在此对Hugging Face作者及其开源社区表示感谢。

License

PaddleNLP遵循Apache-2.0开源协议

paddlenlp's People

Contributors

smallv0221 avatar liuchiachi avatar linjieccc avatar wawltor avatar zeyuchen avatar frostml avatar zhui avatar joey12300 avatar yingyibiao avatar lemonnoel avatar gongel avatar guoshengcs avatar steffy-zxf avatar kinghuin avatar huhuiwen99 avatar xiemoyuan avatar moebius21 avatar junnyu avatar chenxiaozeng avatar leeyy2020 avatar w5688414 avatar luyaojie avatar hysunflower avatar mawenjie8731 avatar yeliang2258 avatar 1649759610 avatar ceci3 avatar baibaifan avatar forfishes avatar fiyen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.