Chinese Pre-Trained XLNet (Base)

Description

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

This model is based on CMU/Google official XLNet: https://github.com/zihangdai/xlnet

Download

How to use

embeddings = XlnetEmbeddings.pretrained("chinese_xlnet_base", "zh") \
      .setInputCols("sentence", "token") \
      .setOutputCol("embeddings")
val embeddings = XlnetEmbeddings.pretrained("chinese_xlnet_base", "zh")
      .setInputCols("sentence", "token")
      .setOutputCol("embeddings")
import nlu

text = ["I love NLP"]
embeddings_df = nlu.load('zh.embed.chinese_xlnet_base').predict(text, output_level='token')
embeddings_df

Model Information

Model Name: chinese_xlnet_base
Compatibility: Spark NLP 3.1.2+
License: Open Source
Edition: Official
Input Labels: [token, sentence]
Output Labels: [embeddings]
Language: zh
Case sensitive: true

Data Source

https://huggingface.co/hfl/chinese-xlnet-base