BERT Classifier

Analytics Zoo provides a built-in BERTClassifier in TFPark for Natural Language Processing (NLP) classification tasks based on TFEstimator and BERT.

Bidirectional Encoder Representations from Transformers (BERT) is Google's state-of-the-art pre-trained NLP model. You may refer to here for more details.

BERTClassifier is a pre-built TFEstimator that takes the hidden state of the first token to do classification.


After constructing a BERTClassifier, you can directly call train, evaluate or predict in a distributed fashion. See here for more instructions.

from zoo.tfpark.text.estimator import BERTClassifier

estimator = BERTClassifier(num_classes, bert_config_file, init_checkpoint=None, use_one_hot_embeddings=False, optimizer=None, model_dir=None)