Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible regression when declaring a SequentialRNN #283

Closed
tacchinotacchi opened this issue Nov 4, 2019 · 0 comments
Closed

Possible regression when declaring a SequentialRNN #283

tacchinotacchi opened this issue Nov 4, 2019 · 0 comments

Comments

@tacchinotacchi
Copy link
Contributor

tacchinotacchi commented Nov 4, 2019

I'm running this code

import fastai2.text.models as models

config = models.awd_lstm_clas_config.copy()
update = {
    "emb_sz": 300,
    "n_layers": 1,
    "bidir": True,
}
config.update(update)
model = models.get_text_classifier(models.AWD_LSTM, len(vocab), 2, config=config, lin_ftrs=[400])

It works fine at commit 03e59c4, but I get this error on master:

I'm getting this error while in models.get_text_classifier:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-5-faed1ecbfc39> in <module>
     20 config.update(update)
     21 
---> 22 model = models.get_text_classifier(models.AWD_LSTM, len(vocab), 2, config=config, lin_ftrs=[400])

~/Documents/fastai_dev/fastai2/text/models/core.py in get_text_classifier(arch, vocab_sz, n_class, bptt, config, drop_mult, lin_ftrs, ps, pad_idx)
    129     init = config.pop('init') if 'init' in config else None
    130     encoder = SentenceEncoder(bptt, arch(vocab_sz, **config), pad_idx=pad_idx)
--> 131     model = SequentialRNN(encoder, PoolingLinearClassifier(layers, ps))
    132     return model if init is None else model.apply(init)

~/Documents/fastai_dev/fastai2/core/foundation.py in __call__(cls, *args, **kwargs)
     28         if type(res)==cls:
     29             if hasattr(res,'__pre_init__'): res.__pre_init__(*args,**kwargs)
---> 30             res.__init__(*args,**kwargs)
     31             if hasattr(res,'__post_init__'): res.__post_init__(*args,**kwargs)
     32         return res

~/Documents/fastai_dev/fastai2/text/models/core.py in __init__(self, dims, ps)
    106         if len(ps) != len(dims)-1: raise ValueError("Number of layers and dropout values do not match.")
    107         acts = [nn.ReLU(inplace=True)] * (len(dims) - 2) + [None]
--> 108         layers = [BnDropLin(i, o, p=p, act=a) for i,o,p,a in zip(dims[:-1], dims[1:], ps, acts)]
    109         self.layers = nn.Sequential(*layers)
    110 

~/Documents/fastai_dev/fastai2/text/models/core.py in <listcomp>(.0)
    106         if len(ps) != len(dims)-1: raise ValueError("Number of layers and dropout values do not match.")
    107         acts = [nn.ReLU(inplace=True)] * (len(dims) - 2) + [None]
--> 108         layers = [BnDropLin(i, o, p=p, act=a) for i,o,p,a in zip(dims[:-1], dims[1:], ps, acts)]
    109         self.layers = nn.Sequential(*layers)
    110 

NameError: name 'BnDropLin' is not defined

EDIT: my bad, I was pulling from my own fork instead of this repo and I missed the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant