Skip to content

Error while using pretrained model #2

Open

Description

@EngSalem

I am trying to use your QRNN model on my own dataset on colab, the fastain version I am using is 1.0.51 as in your notebook. I am using same qrnn configuration, yet I am getting this error:

ImportError: No module named 'forget_mult_cuda'

do you happen to know why

Activity

  1. Rashwan commented on Apr 9, 2019

    @Rashwan
    Owner

    Sorry for the late response, Could you share the full error stack trace?

  2. EngSalem commented on Apr 9, 2019

    @EngSalem
    Author

    NP Ahmed,

    I am trying to use your model on my own data on colab.

    I am getting this error when I pass your qrnn configuration


    ImportError Traceback (most recent call last)
    in ()
    ----> 1 lm_learner = language_model_learner(data_lm,AWD_LSTM,pretrained=False,config=qrnn_config,drop_mult=.3,pretrained_fnames=pretrained_fnames)

    /usr/local/lib/python3.6/dist-packages/fastai/text/learner.py in language_model_learner(data, arch, config, drop_mult, pretrained, pretrained_fnames, **learn_kwargs)
    202 pretrained_fnames:OptStrTuple=None, **learn_kwargs) -> 'LanguageLearner':
    203 "Create a Learner with a language model from data and arch."
    --> 204 model = get_language_model(arch, len(data.vocab.itos), config=config, drop_mult=drop_mult)
    205 meta = _model_meta[arch]
    206 learn = LanguageLearner(data, model, split_func=meta['split_lm'], **learn_kwargs)

    /usr/local/lib/python3.6/dist-packages/fastai/text/learner.py in get_language_model(arch, vocab_sz, config, drop_mult)
    193 tie_weights,output_p,out_bias = map(config.pop, ['tie_weights', 'output_p', 'out_bias'])
    194 init = config.pop('init') if 'init' in config else None
    --> 195 encoder = arch(vocab_sz, **config)
    196 enc = encoder.encoder if tie_weights else None
    197 decoder = LinearDecoder(vocab_sz, config[meta['hid_name']], output_p, tie_encoder=enc, bias=out_bias)

    /usr/local/lib/python3.6/dist-packages/fastai/text/models/awd_lstm.py in init(self, vocab_sz, emb_sz, n_hid, n_layers, pad_token, hidden_p, input_p, embed_p, weight_p, qrnn, bidir)
    88 if self.qrnn:
    89 #Using QRNN requires an installation of cuda
    ---> 90 from .qrnn import QRNN
    91 self.rnns = [QRNN(emb_sz if l == 0 else n_hid, n_hid if l != n_layers - 1 else emb_sz, 1,
    92 save_prev_x=True, zoneout=0, window=2 if l == 0 else 1, output_gate=True)

    /usr/local/lib/python3.6/dist-packages/fastai/text/models/qrnn.py in ()
    9 fastai_path = Path(fastai.path[0])/'text'/'models'
    10 files = ['forget_mult_cuda.cpp', 'forget_mult_cuda_kernel.cu']
    ---> 11 forget_mult_cuda = load(name='forget_mult_cuda', sources=[fastai_path/f for f in files])
    12 files = ['bwd_forget_mult_cuda.cpp', 'bwd_forget_mult_cuda_kernel.cu']
    13 bwd_forget_mult_cuda = load(name='bwd_forget_mult_cuda', sources=[fastai_path/f for f in files])

    /usr/local/lib/python3.6/dist-packages/torch/utils/cpp_extension.py in load(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_python_module)
    643 verbose,
    644 with_cuda,
    --> 645 is_python_module)
    646
    647

    /usr/local/lib/python3.6/dist-packages/torch/utils/cpp_extension.py in _jit_compile(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_python_module)
    823 if verbose:
    824 print('Loading extension module {}...'.format(name))
    --> 825 return _import_module_from_library(name, build_directory, is_python_module)
    826
    827

    /usr/local/lib/python3.6/dist-packages/torch/utils/cpp_extension.py in _import_module_from_library(module_name, path, is_python_module)
    962 def _import_module_from_library(module_name, path, is_python_module):
    963 # https://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path
    --> 964 file, path, description = imp.find_module(module_name, [path])
    965 # Close the .so file after load.
    966 with file:

    /usr/lib/python3.6/imp.py in find_module(name, path)
    295 break # Break out of outer loop when breaking out of inner loop.
    296 else:
    --> 297 raise ImportError(_ERR_MSG.format(name), name=name)
    298
    299 encoding = None

    ImportError: No module named 'forget_mult_cuda'

    I am using same version of fastai as in your notebook

  3. matcosta23 commented on Nov 20, 2019

    @matcosta23

    Hello!

    I'm getting the same error... Did you find any kind of solution?

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions