roywei commented on issue #11859: error in bind model after load checkpoint in 
example named_entity_recognition
URL: 
https://github.com/apache/incubator-mxnet/issues/11859#issuecomment-436905247
 
 
   Hi @eziolotta , there are some limitations on saving bucketing module. refer 
to https://github.com/apache/incubator-mxnet/issues/5289
   For now, you can reconstruct the bucketing module and only use saved params. 
You can follow this example, and also refer to 
https://github.com/apache/incubator-mxnet/issues/5008
   The following code works for me
   ```
       # use sym_gen from ner.py to reconstruct the bucketing module
       predict_module = mx.mod.BucketingModule(sym_gen, 
train_iter.default_bucket_key, context=devs)
       _, arg_params, aux_params = 
mx.model.load_checkpoint("../results/checkpoint", 1)
       predict_module.bind(val_iter.provide_data, val_iter.provide_label, 
for_training=False)
       predict_module.set_params(arg_params, aux_params)
       predict_module.forward(val_iter.next(), is_train=False)
       outs = test_module.get_outputs()
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to