Skip to content

Commit fb2b137

Browse files
lingvo-botcopybara-github
authored andcommitted
Add a param to control whether to use bias in LN
PiperOrigin-RevId: 644495160
1 parent 4b3e5f2 commit fb2b137

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lingvo/core/batch_major_attention.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8652,6 +8652,8 @@ def Params(cls):
86528652
),
86538653
)
86548654
p.Define('use_fused_layernorm', False, 'Whether to use fused layernorm. ')
8655+
p.Define('ln_use_bias', True, 'Whether to use bias in layernorm. When bias'
8656+
'is not used, it is RMSNorm (https://arxiv.org/abs/1910.07467)')
86558657
p.Define('layernorm_tpl', layers.LayerNorm.Params(), 'Template for the '
86568658
'LayerNorm layers. use_fused_layernorm param above overrides the '
86578659
'layernorm_tpl.use_fused_layernorm for compatibility.')
@@ -8760,6 +8762,7 @@ def _DefaultLN(self, name):
87608762
name=name,
87618763
input_dim=p.model_dim,
87628764
use_fused_layernorm=p.use_fused_layernorm,
8765+
bias=p.ln_use_bias,
87638766
fprop_dtype=p.fprop_dtype)
87648767

87658768
def _ExpandDims(self, name):

0 commit comments

Comments
 (0)