Clarify dropout and seed in Tok2Vec

This commit is contained in:
Matthw Honnibal 2020-07-06 17:50:21 +02:00
parent 19d42f42de
commit 709fc5e4ad

View File

@ -263,20 +263,20 @@ def build_Tok2Vec_model(
cols = [ID, NORM, PREFIX, SUFFIX, SHAPE, ORTH] cols = [ID, NORM, PREFIX, SUFFIX, SHAPE, ORTH]
with Model.define_operators({">>": chain, "|": concatenate, "**": clone}): with Model.define_operators({">>": chain, "|": concatenate, "**": clone}):
norm = HashEmbed( norm = HashEmbed(
nO=width, nV=embed_size, column=cols.index(NORM), dropout=dropout, nO=width, nV=embed_size, column=cols.index(NORM), dropout=None,
seed=0 seed=0
) )
if subword_features: if subword_features:
prefix = HashEmbed( prefix = HashEmbed(
nO=width, nV=embed_size // 2, column=cols.index(PREFIX), dropout=dropout, nO=width, nV=embed_size // 2, column=cols.index(PREFIX), dropout=None,
seed=1 seed=1
) )
suffix = HashEmbed( suffix = HashEmbed(
nO=width, nV=embed_size // 2, column=cols.index(SUFFIX), dropout=dropout, nO=width, nV=embed_size // 2, column=cols.index(SUFFIX), dropout=None,
seed=2 seed=2
) )
shape = HashEmbed( shape = HashEmbed(
nO=width, nV=embed_size // 2, column=cols.index(SHAPE), dropout=dropout, nO=width, nV=embed_size // 2, column=cols.index(SHAPE), dropout=None,
seed=3 seed=3
) )
else: else:
@ -296,7 +296,7 @@ def build_Tok2Vec_model(
>> Maxout( >> Maxout(
nO=width, nO=width,
nI=width * columns, nI=width * columns,
nP=maxout_pieces, nP=3,
dropout=0.0, dropout=0.0,
normalize=True, normalize=True,
), ),
@ -309,7 +309,7 @@ def build_Tok2Vec_model(
>> Maxout( >> Maxout(
nO=width, nO=width,
nI=width * columns, nI=width * columns,
nP=maxout_pieces, nP=3,
dropout=0.0, dropout=0.0,
normalize=True, normalize=True,
), ),
@ -322,7 +322,7 @@ def build_Tok2Vec_model(
>> Maxout( >> Maxout(
nO=width, nO=width,
nI=width * columns, nI=width * columns,
nP=maxout_pieces, nP=3,
dropout=0.0, dropout=0.0,
normalize=True, normalize=True,
), ),
@ -335,7 +335,7 @@ def build_Tok2Vec_model(
reduce_dimensions = Maxout( reduce_dimensions = Maxout(
nO=width, nO=width,
nI=nM * nC + width, nI=nM * nC + width,
nP=maxout_pieces, nP=3,
dropout=0.0, dropout=0.0,
normalize=True, normalize=True,
) )