GluonNLP: NLP made easy

Get Started: A Quick Example

Here is a quick example that downloads and creates a word embedding model and then computes the cosine similarity between two words.

(You can click the play button below to run this example.)

Model Zoo

Word Embeddingmodel_zoo/word_embeddings/index.html

Mapping words to vectors.

Language Modelingmodel_zoo/language_model/index.html

Learning the distribution and representation of sequences of words.

Machine Translationmodel_zoo/machine_translation/index.html

From “Hello” to “Bonjour”.

Text Classificationmodel_zoo/text_classification/index.html

Categorize texts and documents.

Sentiment Analysismodel_zoo/sentiment_analysis/index.html

Classifying polarity of emotions and opinions.

Parsingmodel_zoo/parsing/index.html

Dependency parsing.

Natural Language Inferencemodel_zoo/natural_language_inference/index.html

Determine if the premise semantically entails the hypothesis.

Text Generationmodel_zoo/text_generation/index.html

Generating language from models.

BERTmodel_zoo/bert/index.html

Transferring pre-trained language representations to language understanding tasks.

Named Entity Recognitionmodel_zoo/ner/index.html

Locating and classifying named entity mentioned in unstructured texts.

Intent Classification and Slot Labelingmodel_zoo/intent_cls_slot_labeling/index.html

Predicting the intent of the query and extracting semantic concepts in the query.

Model Conversionmodel_zoo/conversion_tools/index.html

Converting NLP models from other frameworks to GluonNLP.

And more in tutorials.

Installation

Select your preferences and run the install command.

OS: Linux macOS Windows

Version: Stable Nightly Source

Stable Release.
Nightly build with latest features.
Install GluonNLP from source.

Backend: Native CUDA MKL-DNN CUDA + MKL-DNN

Build-in backend for CPU.
Required to run on Nvidia GPUs.
Accelerate Intel CPU performance.
Enable both Nvidia GPUs and Intel CPU acceleration.

Prerequisites:

  • Requires pip >= 9.. Python 3.5+ are supported.

  • Nightly build provides latest features for enthusiasts.

Command:

pip install --upgrade mxnet gluonnlp
# Here we assume CUDA 10.0 is installed. You can change the number
# according to your own CUDA version.
pip install --upgrade mxnet-cu100 gluonnlp
pip install --upgrade mxnet-mkl gluonnlp
# Here we assume CUDA 10.0 is installed. You can change the number
# according to your own CUDA version.
pip install --upgrade mxnet-cu100mkl gluonnlp
pip install --pre --upgrade mxnet https://github.com/dmlc/gluon-nlp/tarball/master
pip install --pre --upgrade mxnet-cu100 https://github.com/dmlc/gluon-nlp/tarball/master
pip install --pre --upgrade mxnet-mkl https://github.com/dmlc/gluon-nlp/tarball/master
pip install --pre --upgrade mxnet-cu100mkl https://github.com/dmlc/gluon-nlp/tarball/master
pip install --pre --upgrade mxnet
git clone https://github.com/dmlc/gluon-nlp --branch master
cd gluon-nlp && python setup.py install --user
pip install --pre --upgrade mxnet-cu100
git clone https://github.com/dmlc/gluon-nlp
cd gluon-nlp && python setup.py install --user
pip install --pre --upgrade mxnet-mkl
git clone https://github.com/dmlc/gluon-nlp
cd gluon-nlp && python setup.py install --user
pip install --pre --upgrade mxnet-cu100mkl
git clone https://github.com/dmlc/gluon-nlp
cd gluon-nlp && python setup.py install --user

Check Installation for more installation instructions and options.

About GluonNLP

Hint

You can find our the doc for our master development branch here.

GluonNLP provides implementations of the state-of-the-art (SOTA) deep learning models in NLP, and build blocks for text data pipelines and models. It is designed for engineers, researchers, and students to fast prototype research ideas and products based on these models. This toolkit offers five main features:

  1. Training scripts to reproduce SOTA results reported in research papers.

  2. Pre-trained models for common NLP tasks.

  3. Carefully designed APIs that greatly reduce the implementation complexity.

  4. Tutorials to help get started on new NLP tasks.

  5. Community support.

This toolkit assumes that users have basic knowledge about deep learning and NLP. Otherwise, please refer to an introductory course such as Dive into Deep Learning or Stanford CS224n. If you are not familiar with Gluon, check out the Gluon documentation. You may find the 60-min Gluon crash course linked from there especially helpful.