资源算法pytext

pytext

2019-09-11 | |  91 |   0 |   0

Overview

CircleCI

PyText is a deep-learning based NLP modeling framework built on PyTorch. PyText addresses the often-conflicting requirements of enabling rapid experimentation and of serving models at scale. It achieves this by providing simple and extensible interfaces and abstractions for model components, and by using PyTorchs capabilities of exporting models for inference via the optimized Caffe2 execution engine. We are using PyText in Facebook to iterate quickly on new modeling ideas and then seamlessly ship them at scale.

Core PyText features: - Production ready models for various NLP/NLU tasks: - Text classifiers - Yoon Kim (2014): Convolutional Neural Networks for Sentence Classification - Lin et al. (2017): A Structured Self-attentive Sentence Embedding - Sequence taggers - Lample et al. (2016): Neural Architectures for Named Entity Recognition - Joint intent-slot model - Zhang et al. (2016): A Joint Model of Intent Determination and Slot Filling for Spoken Language Understanding - Contextual intent-slot models - Distributed-training support built on the new C10d backend in PyTorch 1.0 - Extensible components that allows easy creation of new models and tasks - Reference implementation and a pretrained model for the paper: Gupta et al. (2018): Semantic Parsing for Task Oriented Dialog using Hierarchical Representations - Ensemble training support

Installing PyText

PyText requires Python 3.6.1 or above.

To get started on a Cloud VM, check out our guide.

We recommend using a virtualenv:

  $ python3 -m venv pytext_venv
  $ source pytext_venv/bin/activate
  (pytext_venv) $ pip install pytext-nlp

Detailed instructions and more installation options can be found in our Documentation. If you encounter issues with missing dependencies during installation, please refer to OS Dependencies.

Train your first text classifier

For this first example, we'll train a CNN-based text-classifier that classifies text utterances, using the examples in tests/data/train_data_tiny.tsv. The data and configs files can be obtained either by cloning the repository or by downloading the files manually from GitHub.

  (venv) $ pytext train < demo/configs/docnn.json

By default, the model is created in /tmp/model.pt

Now you can export your model as a caffe2 net:

  (venv) $ pytext export < demo/configs/docnn.json

You can use the exported caffe2 model to predict the class of raw utterances like this:

  (venv) $ pytext --config-file demo/configs/docnn.json predict <<< '{"raw_text": "create an alarm for 1:30 pm"}'

More examples and tutorials can be found in Full Documentation.

Join the community

  • Facebook group: https://www.facebook.com/groups/pytext/

License

PyText is BSD-licensed, as found in the LICENSE file.

上一篇:Collection of Generative Models with PyTorch

下一篇:fairseq-py

用户评价
全部评价

热门资源

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • capsnet-with-caps...

    CapsNet with capsule-wise convolution Project ...

  • inferno-boilerplate

    This is a very basic boilerplate example for pe...