Chinese Bert Embeddings (from qinluo)

Description

Pretrained Bert Embeddings model, uploaded to Hugging Face, adapted and imported into Spark NLP. wobert-chinese-plus is a Chinese model orginally trained by qinluo.

Download Copy S3 URICopied!

How to use

documentAssembler = DocumentAssembler() \
.setInputCol("text") \
.setOutputCol("document")

tokenizer = Tokenizer() \
.setInputCols("document") \
.setOutputCol("token")

embeddings = BertEmbeddings.pretrained("bert_embeddings_wobert_chinese_plus","zh") \
.setInputCols(["document", "token"]) \
.setOutputCol("embeddings")

pipeline = Pipeline(stages=[documentAssembler, tokenizer, embeddings])

data = spark.createDataFrame([["I love Spark NLP"]]).toDF("text")

result = pipeline.fit(data).transform(data)

Model Information

Model Name: bert_embeddings_wobert_chinese_plus
Compatibility: Spark NLP 3.4.2+
License: Open Source
Edition: Official
Input Labels: [sentence, token]
Output Labels: [bert]
Language: zh
Size: 467.4 MB
Case sensitive: true

References

  • https://huggingface.co/qinluo/wobert-chinese-plus
  • https://github.com/ZhuiyiTechnology/WoBERT
  • https://github.com/JunnYu/WoBERT_pytorch