ALBERT Embeddings (XXLarge Uncase)

Description

ALBERT is “A Lite” version of BERT, a popular unsupervised language representation learning algorithm. ALBERT uses parameter-reduction techniques that allow for large-scale configurations, overcome previous memory limitations, and achieve better behavior with respect to model degradation. The details are described in the paper “ALBERT: A Lite BERT for Self-supervised Learning of Language Representations.

Download Copy S3 URI

How to use

...
embeddings = AlbertEmbeddings.pretrained("albert_xxlarge_uncased", "en") \
.setInputCols("sentence", "token") \
.setOutputCol("embeddings")
nlp_pipeline = Pipeline(stages=[document_assembler, sentence_detector, tokenizer, embeddings])
pipeline_model = nlp_pipeline.fit(spark.createDataFrame([[""]]).toDF("text"))
result = pipeline_model.transform(spark.createDataFrame([['I love NLP']], ["text"]))
...
val embeddings = AlbertEmbeddings.pretrained("albert_xxlarge_uncased", "en")
.setInputCols("sentence", "token")
.setOutputCol("embeddings")
val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, tokenizer, embeddings))
val data = Seq("I love NLP").toDF("text")
val result = pipeline.fit(data).transform(data)
import nlu

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

Results

	token	en_embed_albert_xxlarge_uncased_embeddings
	
	I	[-0.07972775399684906, 0.06297606974840164, 0....
	love	[-0.07597140967845917, 0.05237535387277603, 0....
	NLP	[0.005398618057370186, -0.0253510233014822, 0....

Model Information

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

Data Source

The model is imported from https://tfhub.dev/google/albert_xlarge/3