This action will force synchronization from fastNLP/fastNLP, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
fastNLP是一款轻量级的自然语言处理(NLP)工具包,目标是快速实现NLP任务以及构建复杂模型。
fastNLP具有如下的特性:
fastNLP 依赖以下包:
其中torch的安装可能与操作系统及 CUDA 的版本相关,请参见 PyTorch 官网 。 在依赖包安装完成后,您可以在命令行执行如下指令完成安装
pip install fastNLP
python -m spacy download en
大部分用于的 NLP 任务神经网络都可以看做由词嵌入(embeddings)和两种模块:编码器(encoder)、解码器(decoder)组成。
以文本分类任务为例,下图展示了一个BiLSTM+Attention实现文本分类器的模型流程图:
fastNLP 在 embeddings 模块中内置了几种不同的embedding:静态embedding(GloVe、word2vec)、上下文相关embedding (ELMo、BERT)、字符embedding(基于CNN或者LSTM的CharEmbedding)
与此同时,fastNLP 在 modules 模块中内置了两种模块的诸多组件,可以帮助用户快速搭建自己所需的网络。 两种模块的功能和常见组件如下:
类型 | 功能 | 例子 |
encoder | 将输入编码为具有具有表示能力的向量 | Embedding, RNN, CNN, Transformer, ... |
decoder | 将具有某种表示意义的向量解码为需要的输出形式 | MLP, CRF, ... |
fastNLP的大致工作流程如上图所示,而项目结构如下:
fastNLP | 开源的自然语言处理库 |
fastNLP.core | 实现了核心功能,包括数据处理组件、训练器、测试器等 |
fastNLP.models | 实现了一些完整的神经网络模型 |
fastNLP.modules | 实现了用于搭建神经网络模型的诸多组件 |
fastNLP.embeddings | 实现了将序列index转为向量序列的功能,包括读取预训练embedding等 |
fastNLP.io | 实现了读写功能,包括数据读入与预处理,模型读写,数据与模型自动下载等 |
In memory of @FengZiYjun. May his soul rest in peace. We will miss you very very much!
Sign in for post a comment
Comments ( 0 )