README.md 1.55 KB
Newer Older
1
2
# Models

Chen Chen's avatar
Chen Chen committed
3
Models are combinations of `tf.keras` layers and models that can be trained.
4

Chen Chen's avatar
Chen Chen committed
5
6
Several pre-built canned models are provided to train encoder networks.
These models are intended as both convenience functions and canonical examples.
7
8
9

* [`BertClassifier`](bert_classifier.py) implements a simple classification
model containing a single classification head using the Classification network.
10
It can be used as a regression model as well.
11

12
* [`BertTokenClassifier`](bert_token_classifier.py) implements a simple token
13
14
classification model containing a single classification head over the sequence
output embeddings.
15

16
17
18
19
20
21
22
* [`BertSpanLabeler`](bert_span_labeler.py) implementats a simple single-span
start-end predictor (that is, a model that predicts two values: a start token
index and an end token index), suitable for SQuAD-style tasks.

* [`BertPretrainer`](bert_pretrainer.py) implements a masked LM and a
classification head using the Masked LM and Classification networks,
respectively.
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
23
24
25

* [`DualEncoder`](dual_encoder.py) implements a dual encoder model, suitbale for
retrieval tasks.
Hongkun Yu's avatar
Hongkun Yu committed
26
27
28
29
30
31
32
33
34

* [`Seq2SeqTransformer`](seq2seq_transformer.py) implements the original
Transformer model for seq-to-seq tasks.

* [`T5Transformer`](t5.py) implements a standalone T5 model for seq-to-seq
tasks. The models are compatible with released T5 architecture and converted
checkpoints. The modules are implemented as `tf.Module`. To use with Keras,
users can wrap them within Keras customized layers, i.e. we can define the
modules inside the `__init__` of Keras layer and call the modules in `call`.