mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 10:16:27 +03:00
Specify seeds in HashEmbed
This commit is contained in:
parent
2bd1bf81f1
commit
8870a6ded7
|
@ -263,17 +263,21 @@ 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=dropout,
|
||||||
|
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=dropout,
|
||||||
|
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=dropout,
|
||||||
|
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=dropout,
|
||||||
|
seed=3
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
prefix, suffix, shape = (None, None, None)
|
prefix, suffix, shape = (None, None, None)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user