-
Notifications
You must be signed in to change notification settings - Fork 9
/
de_t5_base.gin
45 lines (38 loc) · 1.27 KB
/
de_t5_base.gin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Dual Encoder based on original T5 (1.0) Base model.
# Provides MODEL
from __gin__ import dynamic_registration
import seqio
from t5x import adafactor
from t5x_retrieval import feature_converters
from t5x_retrieval import models
from t5x_retrieval import losses
ARCHITECTURE = %gin.REQUIRED
LOSS_MODULE = @losses.InBatchCrossEntropyLoss
include 't5x_retrieval/configs/architectures/de_t5_flaxformer.gin'
# Architecture overrides
NUM_HEADS = 12
NUM_LAYERS = 12
HEAD_DIM = 64
EMBED_DIM = 768
MLP_DIM = 3072
PROJECTION_DIM = 768
# Vocabulary (shared by encoder and decoder)
VOCABULARY = @seqio.SentencePieceVocabulary()
seqio.SentencePieceVocabulary.sentencepiece_model_file = "gs://t5-data/vocabs/cc_all.32000.100extra/sentencepiece.model"
# Optimizer
# `learning_rate` is set by `Trainer.learning_rate_fn`.
OPTIMIZER = @adafactor.Adafactor()
adafactor.Adafactor:
decay_rate = 0.8
step_offset = 0
# Model
MODEL = @models.DualEncoderModel()
models.DualEncoderModel:
use_negatives = False
use_align_uniform = False
feature_converter_cls = @feature_converters.DualEncoderFeatureConverterFactory()
module = %ARCHITECTURE # provided by t5_flaxformer
loss_module_factory = %LOSS_MODULE
input_vocabulary = %VOCABULARY
output_vocabulary = %VOCABULARY
optimizer_def = %OPTIMIZER