mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-15 06:09:01 +03:00
Pass Tok2Vec settings a bit better
This commit is contained in:
parent
fef50277d7
commit
b4e0040d10
12
spacy/_ml.py
12
spacy/_ml.py
|
@ -406,15 +406,11 @@ def Tok2Vec(width, embed_size, **kwargs):
|
|||
pretrained_vectors = kwargs.get("pretrained_vectors", None)
|
||||
cnn_maxout_pieces = kwargs.get("cnn_maxout_pieces", 3)
|
||||
subword_features = kwargs.get("subword_features", True)
|
||||
char_embed = util.env_opt("char_embed", kwargs.get("char_embed", False))
|
||||
char_embed = kwargs.get("char_embed", False)
|
||||
conv_depth = kwargs.get("conv_depth", 4)
|
||||
bilstm_depth = util.env_opt("bilstm_depth", kwargs.get("bilstm_depth", 0))
|
||||
self_attn_depth = util.env_opt("self_attn_depth", kwargs.get("self_attn_depth", 0))
|
||||
conv_window = util.env_opt("conv_window", kwargs.get("cnn_window", 1))
|
||||
kwargs.setdefault("bilstm_depth", bilstm_depth)
|
||||
kwargs.setdefault("self_attn_depth", self_attn_depth)
|
||||
kwargs.setdefault("char_embed", char_embed)
|
||||
kwargs.setdefault("conv_window", conv_window)
|
||||
bilstm_depth = kwargs.get("bilstm_depth", 0)
|
||||
self_attn_depth = kwargs.get("self_attn_depth", 0)
|
||||
conv_window = kwargs.get("conv_window", 1)
|
||||
if char_embed and self_attn_depth:
|
||||
return Tok2Vec_chars_selfattention(width, embed_size, **kwargs)
|
||||
elif char_embed and bilstm_depth:
|
||||
|
|
Loading…
Reference in New Issue
Block a user