README.md 1.66 KB
Newer Older
Hongkun Yu's avatar
Hongkun Yu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

15
16
# Models

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

Chen Chen's avatar
Chen Chen committed
19
20
Several pre-built canned models are provided to train encoder networks.
These models are intended as both convenience functions and canonical examples.
21
22
23

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

26
* [`BertTokenClassifier`](bert_token_classifier.py) implements a simple token
27
28
classification model containing a single classification head over the sequence
output embeddings.
29

30
31
32
33
34
35
36
* [`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
37
38
39

* [`DualEncoder`](dual_encoder.py) implements a dual encoder model, suitbale for
retrieval tasks.