You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/10/14 20:32:24 UTC

[GitHub] [incubator-mxnet] samskalicky opened a new issue #19351: Softmax_label magically appears

samskalicky opened a new issue #19351:
URL: https://github.com/apache/incubator-mxnet/issues/19351


   ## Description
   The Softmax/SoftmaxOutput operator has an optional `label` input that is enabled by setting the `ignore_label` or `use_length`:
   https://github.com/apache/incubator-mxnet/blob/master/src/operator/nn/softmax-inl.h#L616-L618
   https://github.com/apache/incubator-mxnet/blob/v1.x/src/operator/softmax_output-inl.h#L61-L63
   
   Many common image classification/CNN models use softmax, but dont use the `softmax_label` input meaningfully. Yet there is an actual input to the model for this.
   
   ### Error Message
   Symbol/Module flow:
   ```
   Traceback (most recent call last):
     File "test.py", line 13, in <module>
       mod.set_params(args, aux)
     File "/home/ubuntu/incubator-mxnet/python/mxnet/module/module.py", line 350, in set_params
       allow_extra=allow_extra)
     File "/home/ubuntu/incubator-mxnet/python/mxnet/module/module.py", line 309, in init_params
       _impl(desc, arr, arg_params)
     File "/home/ubuntu/incubator-mxnet/python/mxnet/module/module.py", line 300, in _impl
       raise RuntimeError("%s is not presented" % name)
   RuntimeError: softmax_label is not presented
   ```
   
   Gluon flow:
   ```
   Traceback (most recent call last):
     File "test.py", line 5, in <module>
       'resnet-18-0000.params')
     File "/home/ubuntu/incubator-mxnet/python/mxnet/gluon/block.py", line 1409, in imports
       dtype_source='saved')
     File "/home/ubuntu/incubator-mxnet/python/mxnet/gluon/parameter.py", line 1020, in load
       ignore_extra, restore_prefix, filename, cast_dtype, dtype_source)
     File "/home/ubuntu/incubator-mxnet/python/mxnet/gluon/parameter.py", line 1057, in load_dict
       name[lprefix:], error_str, _brief_print_list(arg_dict.keys()))
   AssertionError: Parameter 'softmax_label' is missing in file: resnet-18-0000.params, which contains parameters: 'stage1_unit1_sc_weight', 'stage2_unit1_bn2_gamma', 'bn_data_moving_var', ..., 'stage2_unit2_conv1_weight', 'stage1_unit2_bn1_gamma', 'stage2_unit2_bn1_moving_var', 'stage2_unit2_bn2_moving_var'. Please make sure source and target networks have the same prefix.For more info on naming, please see https://mxnet.io/api/python/docs/tutorials/packages/gluon/blocks/naming.html
   ```
   ## To Reproduce
   comment out the `allow_missing=True` to reproduce the error messages. 
   ```
   import mxnet as mx
   
   path='http://data.mxnet.io/models/imagenet/'
   [mx.test_utils.download(path+'resnet/18-layers/resnet-18-0000.params'),
    mx.test_utils.download(path+'resnet/18-layers/resnet-18-symbol.json')]
    
   block = mx.gluon.nn.SymbolBlock.imports('resnet-18-symbol.json',
                                           ['data'],
                                           'resnet-18-0000.params',
                                           allow_missing=True)
   
   sym, args, aux = mx.model.load_checkpoint('resnet-18',0)
   mod = mx.mod.Module(symbol=sym, context=mx.cpu(), label_names=None)
   mod.bind(for_training=False, data_shapes=[('data', (1,3,224,224))],
            label_shapes=mod._label_shapes)
   mod.set_params(args, aux,
                  allow_missing=True)
   ```
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] xmfbit commented on issue #19351: Softmax_label magically appears

Posted by GitBox <gi...@apache.org>.
xmfbit commented on issue #19351:
URL: https://github.com/apache/incubator-mxnet/issues/19351#issuecomment-994534654


   I have met the same problem, and how to fix it?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org