GluonNLP: a Deep Learning Toolkit for Natural Language Processing (NLP)

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 four 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. Community support.

This toolkit assumes that users have basic knowledge about deep learning and NLP. Otherwise, please refer to an introduction course such as Deep Learning—The Straight Dope or Stanford CS224n.

The toolkit supports the following NLP tasks:

  1. Word Embedding
  2. Language Model
  3. Machine Translation
  4. Text Classification
  5. Sentiment Analysis
  6. Text Generation


We can be found on Github. This project is at an early stage and is under active development, so please expect frequent updates. Check out our contribution guide to see how you can help.


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


GluonNLP relies on the recent version of MXNet. The easiest way to install MXNet is through pip. The following command installs a nightly built CPU version of MXNet.

pip install --upgrade mxnet==1.3.0


There are other pre-build MXNet packages that enable GPU supports and accelerate CPU performance, please refer to this tutorial for details. Some training scripts are recommended to run on GPUs, if you don’t have a GPU machine at hands, you may consider running on AWS.

Then install the GluonNLP toolkit by

pip install gluonnlp

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 go button on the right bottom corner to run this example.)