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

RuntimeError: prob_label is not presented #19

Open
anboqing opened this issue Nov 29, 2016 · 1 comment
Open

RuntimeError: prob_label is not presented #19

anboqing opened this issue Nov 29, 2016 · 1 comment

Comments

@anboqing
Copy link

anboqing commented Nov 29, 2016

#Hi,

I got an RuntimeError: prob_label is not presented when I run [http://mxnet.io/tutorials/python/predict_imagenet.html](Example : Predict with pretrained model) with pretrained model https://github.com/dmlc/mxnet-model-gallery/blob/master/imagenet-1k-nin.md.

first , I load pretrained model follow the tutorial:

import mxnet as mx
sym, arg_params, aux_params = mx.model.load_checkpoint('nin', 0)

I found 'prob_label' in sym.list_arguments() but it is not exists in 'arg_params'

when I create a model for this model on GPU 0 like this:

mod = mx.mod.Module(symbol=sym, context=mx.gpu())
mod.bind(for_training=False, data_shapes=[('data', (1,3,224,224))])
mod.set_params(arg_params, aux_params)

the error occurs at mod.set_params(arg_params, aux_params) ,

Traceback (most recent call last):
  File "loadmodel.py", line 7, in <module>
    mod.set_params(arg_params, aux_params,allow_missing=False)
  File "/usr/local/lib/python2.7/dist-packages/mxnet-0.7.0-py2.7.egg/mxnet/module/base_module.py", line 483, in set_params
    allow_missing=allow_missing, force_init=force_init)
  File "/usr/local/lib/python2.7/dist-packages/mxnet-0.7.0-py2.7.egg/mxnet/module/module.py", line 198, in init_params
    _impl(name, arr, arg_params)
  File "/usr/local/lib/python2.7/dist-packages/mxnet-0.7.0-py2.7.egg/mxnet/module/module.py", line 191, in _impl
    raise RuntimeError("%s is not presented" % name)
RuntimeError: prob_label is not presented


how can I fix this?
@burness
Copy link

burness commented Dec 8, 2016

I met this problem and fix it by adding arg_params['prob_label'] = mx.nd.array([0]) before mod.set_params(arg_params, aux_params)

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

2 participants