XLNet Embeddings (Base)


XLNet is a new unsupervised language representation learning method based on a novel generalized permutation language modeling objective. Additionally, XLNet employs Transformer-XL as the backbone model, exhibiting excellent performance for language tasks involving long context. Overall, XLNet achieves state-of-the-art (SOTA) results on various downstream language tasks including question answering, natural language inference, sentiment analysis, and document ranking. The details are described in the paper “​XLNet: Generalized Autoregressive Pretraining for Language Understanding


How to use

embeddings = XlnetEmbeddings.pretrained("xlnet_base_cased", "en") \
      .setInputCols("sentence", "token") \

val embeddings = XlnetEmbeddings.pretrained("xlnet_base_cased", "en")
      .setInputCols("sentence", "token")

Model Information

Model Name: xlnet_base_cased
Type: embeddings
Compatibility: Spark NLP 2.5.0+
License: Open Source
Edition: Official
Input Labels: [sentence, token]
Output Labels: [word_embeddings]
Language: [en]
Dimension: 768
Case sensitive: true

Data Source

The model is imported from https://github.com/zihangdai/xlnet