Networks are combinations of layers (and possibly other networks). They are sub-units of models that would not be trained alone. It
Networks are combinations of layers (and possibly other networks).
They are sub-units of models that would not be trained alone. It
encapsulates common network structures like a classification head
encapsulates common network structures like a classification head
or a transformer encoder into an easily handled object with a
or a transformer encoder into an easily handled object with a
standardized configuration.
standardized configuration.
*[`BertEncoder`](bert_encoder.py) implements a bi-directional
*[`BertEncoder`](bert_encoder.py) implements a bi-directional
Transformer-based encoder as described in ["BERT: Pre-training of Deep
Transformer-based encoder as described in ["BERT: Pre-training of Deep
Bidirectional Transformers for Language Understanding"](https://arxiv.org/abs/1810.04805). It includes the embedding lookups,
Bidirectional Transformers for Language Understanding"](https://arxiv.org/abs/1810.04805).
transformer layers and pooling layer.
It includes the embedding lookups, transformer layers and pooling layer.
*[`AlbertEncoder`](albert_encoder.py) implements a
*[`AlbertEncoder`](albert_encoder.py) implements a
Transformer-encoder described in the paper ["ALBERT: A Lite BERT for
Transformer-encoder described in the paper ["ALBERT: A Lite BERT for
Self-supervised Learning of Language Representations"]
Self-supervised Learning of Language Representations"]
(https://arxiv.org/abs/1909.11942). Compared with [BERT](https://arxiv.org/abs/1810.04805), ALBERT refactorizes embedding parameters
(https://arxiv.org/abs/1909.11942). Compared with [BERT](https://arxiv.org/abs/1810.04805),
into two smaller matrices and shares parameters across layers.
ALBERT refactorizes embedding parameters into two smaller matrices and shares
parameters across layers.
*[`MobileBERTEncoder`](mobile_bert_encoder.py) implements the
*[`MobileBERTEncoder`](mobile_bert_encoder.py) implements the
MobileBERT network described in the paper ["MobileBERT: a Compact Task-Agnostic
MobileBERT network described in the paper ["MobileBERT: a Compact Task-Agnostic
...
@@ -24,6 +26,15 @@ BERT for Resource-Limited Devices"](https://arxiv.org/abs/2004.02984).
...
@@ -24,6 +26,15 @@ BERT for Resource-Limited Devices"](https://arxiv.org/abs/2004.02984).
intended for use as a classification or regression (if number of classes is set
intended for use as a classification or regression (if number of classes is set
to 1) head.
to 1) head.
*[`SpanLabeling`](span_labeling.py) implements a single-span labeler (that is, a prediction head that can predict one start and end index per batch item) based on a single dense hidden layer. It can be used in the SQuAD task.
*[`PackedSequenceEmbedding`](packed_sequence_embedding.py) implements an
embedding network that supports packed sequences and position ids.
*[`XLNetBase`](xlnet_base.py) implements the base network used in "XLNet: Generalized Autoregressive Pretraining for Language Understanding"(https://arxiv.org/abs/1906.08237). It includes embedding lookups, relative position encodings, mask computations, segment matrix computations and Transformer XL layers using one or two stream relative self-attention.
*[`SpanLabeling`](span_labeling.py) implements a single-span labeler
(that is, a prediction head that can predict one start and end index per batch
item) based on a single dense hidden layer. It can be used in the SQuAD task.
*[`XLNetBase`](xlnet_base.py) implements the base network used in "XLNet:
Generalized Autoregressive Pretraining for Language Understanding"
(https://arxiv.org/abs/1906.08237). It includes embedding lookups,
relative position encodings, mask computations, segment matrix computations and
Transformer XL layers using one or two stream relative self-attention.