From afeddfff261a39635361e56c293ae371cf219ed2 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 13 Sep 2018 22:54:34 +0000 Subject: [PATCH] Fix PyTorch BiLSTM --- spacy/_ml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/_ml.py b/spacy/_ml.py index 4dbc7cb92..eb751ca6c 100644 --- a/spacy/_ml.py +++ b/spacy/_ml.py @@ -29,6 +29,7 @@ from . import util try: import torch.nn + from thinc.extra.wrappers import PyTorchWrapperRNN except: torch = None @@ -252,7 +253,7 @@ def link_vectors_to_models(vocab): def PyTorchBiLSTM(nO, nI, depth, dropout=0.2): if depth == 0: - return noop() + return layerize(noop()) model = torch.nn.LSTM(nI, nO//2, depth, bidirectional=True, dropout=dropout) return with_square_sequences(PyTorchWrapperRNN(model)) @@ -299,7 +300,6 @@ def Tok2Vec(width, embed_size, **kwargs): ExtractWindow(nW=1) >> LN(Maxout(width, width*3, pieces=cnn_maxout_pieces)) ) - tok2vec = ( FeatureExtracter(cols) >> with_flatten(