Simple_bind error when loading model?

test model is in my Repo@


model={wolfram.lstm.json, wolfram.lstm-0000.params}
script is in {wolfram_v2/}

import mxnet as mx
import numpy as np
# model_prefix=’/home/hypergroups/Nutstore/ProjectsOnline/MyProjects/MXNetFinal/1.0/model-wolfram/wolfram.lstm’

sym, arg_params, aux_params = mx.model.load_checkpoint(model_prefix, 0)
mod = mx.mod.Module(symbol=sym, context=ctx,


mod.bind(for_training=False, data_shapes=[('Input', (1,2))],
         # label_shapes=mod._label_shapes)

/Users/hypergroups/anaconda2/bin/python /Users/hypergroups/Nutstore/ProjectsOnline/MyProjects/MXNetFinal/1.0/script/wolfram_v2/
/Users/hypergroups/anaconda2/lib/python2.7/site-packages/h5py/ FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
/Users/hypergroups/anaconda2/lib/python2.7/site-packages/urllib3/contrib/ DeprecationWarning: OpenSSL.rand is deprecated - you should use os.urandom instead
import OpenSSL.SSL
[11:06:20] src/nnvm/ Loading symbol saved by previous version v1.0.1. Attempting to upgrade…
[11:06:20] src/nnvm/ Symbol successfully upgraded!
Traceback (most recent call last):
File “/Users/hypergroups/Nutstore/ProjectsOnline/MyProjects/MXNetFinal/1.0/script/wolfram_v2/”, line 17, in
File “/Users/hypergroups/anaconda2/lib/python2.7/site-packages/mxnet/module/”, line 430, in bind
File “/Users/hypergroups/anaconda2/lib/python2.7/site-packages/mxnet/module/”, line 265, in init
self.bind_exec(data_shapes, label_shapes, shared_group)
File “/Users/hypergroups/anaconda2/lib/python2.7/site-packages/mxnet/module/”, line 361, in bind_exec
File “/Users/hypergroups/anaconda2/lib/python2.7/site-packages/mxnet/module/”, line 639, in _bind_ith_exec
shared_buffer=shared_data_arrays, **input_shapes)
File “/Users/hypergroups/anaconda2/lib/python2.7/site-packages/mxnet/symbol/”, line 1519, in simple_bind
raise RuntimeError(error_msg)
RuntimeError: simple_bind error. Arguments:
Input: (1, 2)
[11:06:20] src/executor/ InferShape pass cannot decide shapes for the following arguments (0s means unknown dimensions). Please consider providing them as inputs:
4.State: ,

Stack trace returned 8 entries:
[bt] (0) 0                         0x000000010ecae3b4 + 21428
[bt] (1) 1                         0x000000010ecae16f + 20847
[bt] (2) 2                         0x000000010fd6f3a4 MXNDListFree + 188484
[bt] (3) 3                         0x000000010fd7a9a7 MXNDListFree + 235079
[bt] (4) 4                         0x000000010fd7e16a MXNDListFree + 249354
[bt] (5) 5                         0x000000010fd0e9b0 MXExecutorSimpleBind + 8656
[bt] (6) 6   libffi.6.dylib                      0x000000010e024884 ffi_call_unix64 + 76
[bt] (7) 7   ???                                 0x00007ffee1f51d10 0x0 + 140732689358096

Process finished with exit code 1

the model was trained by Mathematica in MXNet Version 1.0.1
and can be load by MXNet-Python in the another way, show like the following code.

import sys
import numpy as np
import PIL
import os
from myPath import *

if __name__=='__main__':
    from myPath import *
    file_sym=os.path.join(root_dir, 'model-wolfram/wolfram.lstm-symbol.json')
    file_nd=os.path.join(root_dir, 'model-wolfram/wolfram.lstm-0000.params')

    _sym= mx.symbol.load(file_sym)
    _nd= mx.nd.load(file_nd)


    print input_data

    array = mx.nd.array(input_data)

    _nd["Input"] = array
    _e = _sym.bind(ctx, _nd)

    _out = _e.forward()
    prob = _out[0].asnumpy()
    prob = np.squeeze(prob)
    print 'prob', prob
    print 'prob_sort', sorted(prob, reverse=True)
    idx = np.argsort(prob)[::-1]
    print 'top_idx', idx

for reference, question is tracked by this github issue:

Copying github answer for reference:

@HyperGroups can you please show or point me to how you export it from Mathematica?
The reason why you have this error is because only models saved using the module API or the .export function of HybridBlock in Gluon can be loaded using the load_checkpoint function.

As of 1.2.1, you can load your model in Gluon using the HybridBlock.imports function:

import mxnet as mx
from mxnet import gluon

net = gluon.nn.SymbolBlock.imports('example-symbol.json',


Mathematica 11.3 uses 1.0 version of mxnet

But when we I use MXNet 11.3 to import the old model generated by Wolfram Mathematica 11.3 in the post, it gives me
net=gluon.nn.SymbolBlock.imports(sym,[“Input”], param_file=param)

[17:52:40] src/nnvm/ Loading symbol saved by previous version v1.0.1. Attempting to upgrade…
[17:52:40] src/nnvm/ Symbol successfully upgraded!
Traceback (most recent call last):
File “/Users/hypergroups/Nutstore/ProjectsOnline/MyProjects/MathematicaMXNet/1.3/”, line 16, in
convert(mod_export, sym_,nd_)
File “/Users/hypergroups/Nutstore/ProjectsOnline/MyProjects/MathematicaMXNet/1.3/”, line 8, in convert
net=gluon.nn.SymbolBlock.imports(sym,[“Input”], param_file=param)
File “/Users/hypergroups/Program/anaconda2/lib/python2.7/site-packages/mxnet/gluon/”, line 1025, in imports
ret.collect_params().load(param_file, ctx=ctx)
File “/Users/hypergroups/Program/anaconda2/lib/python2.7/site-packages/mxnet/gluon/”, line 909, in load
name[lprefix:], filename, _brief_print_list(arg_dict.keys()))
AssertionError: Parameter ‘4.State’ is missing in file ‘/Users/hypergroups/Nutstore/ProjectsOnline/MyProjects/MathematicaMXNet/model.wolfram.11.3/wolfram.lstm-0000.params’, which contains parameters: ‘4.OutputGateStateWeights’, ‘4.InputGateInputWeights’, ‘5.Biases’, …, ‘4.OutputGateBiases’, ‘4.MemoryGateInputWeights’, ‘4.ForgetGateStateWeights’, ‘4.ForgetGateBiases’. Please make sure source and target networks have the same prefix.