Avoid adding empty layer in model, to keep models backwards compatible

This commit is contained in:
Matthew Honnibal 2018-09-14 22:51:58 +02:00
parent c046392317
commit 99a6011580

View File

@ -306,8 +306,9 @@ def Tok2Vec(width, embed_size, **kwargs):
embed
>> convolution ** conv_depth, pad=conv_depth
)
>> PyTorchBiLSTM(width, width, bilstm_depth)
)
if bilstm_depth >= 1:
tok2vec = tok2vec >> PyTorchBiLSTM(width, width, bilstm_depth)
# Work around thinc API limitations :(. TODO: Revise in Thinc 7
tok2vec.nO = width
tok2vec.embed = embed