You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/05/23 12:08:12 UTC

[GitHub] HyperGroups opened a new issue #11032: Problem with load lstm model with mx.Module's bind

HyperGroups opened a new issue #11032: Problem with load lstm model with mx.Module's bind
URL: https://github.com/apache/incubator-mxnet/issues/11032
 
 
   test model is in my Repo
   MachineLearning/mxnet/python/1.0/model-wolfram/
   model={wolfram.lstm.json, wolfram.lstm-0000.params}
   script is in {wolfram_v2/wolfram.lstm.py}
   
   ```
   import mxnet as mx
   import numpy as np
   model_prefix='/Users/hypergroups/Nutstore/ProjectsOnline/MyProjects/MXNetFinal/1.0/model-wolfram/wolfram.lstm'
   # model_prefix='/home/hypergroups/Nutstore/ProjectsOnline/MyProjects/MXNetFinal/1.0/model-wolfram/wolfram.lstm'
   
   ctx=mx.cpu()
   sym, arg_params, aux_params = mx.model.load_checkpoint(model_prefix, 0)
   mod = mx.mod.Module(symbol=sym, context=ctx,
                       data_names=['Input'],
                       label_names=None)
   
   arg_params['4.State']=mx.nd.array([[0,0,0,0,0]])
   arg_params['4.CellState']=mx.nd.array([[0,0,0,0,0]])
   
   mod.bind(for_training=False, data_shapes=[('Input', (1,2))],
             label_shapes=None)
            # label_shapes=mod._label_shapes)
   
   
   
   mod.set_params(arg_params, aux_params, allow_missing=True)
   ```
   
   the model was trained by Mathematica in MXNet Version  1.0.1
   and can be load by MXNet-Python with the another version code in MXNet Version.
   
   ### Error Info is
   
   ```
   /Users/hypergroups/anaconda2/bin/python /Users/hypergroups/Nutstore/ProjectsOnline/MyProjects/MXNetFinal/1.0/script/wolfram_v2/wolfram.lstm.py
   /Users/hypergroups/anaconda2/lib/python2.7/site-packages/h5py/__init__.py:34: 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/pyopenssl.py:46: DeprecationWarning: OpenSSL.rand is deprecated - you should use os.urandom instead
     import OpenSSL.SSL
   [19:44:03] src/nnvm/legacy_json_util.cc:209: Loading symbol saved by previous version v1.0.1. Attempting to upgrade...
   [19:44:03] src/nnvm/legacy_json_util.cc:217: Symbol successfully upgraded!
   Traceback (most recent call last):
     File "/Users/hypergroups/Nutstore/ProjectsOnline/MyProjects/MXNetFinal/1.0/script/wolfram_v2/wolfram.lstm.py", line 16, in <module>
       label_shapes=None)
     File "/Users/hypergroups/anaconda2/lib/python2.7/site-packages/mxnet/module/module.py", line 430, in bind
       state_names=self._state_names)
     File "/Users/hypergroups/anaconda2/lib/python2.7/site-packages/mxnet/module/executor_group.py", line 265, in __init__
       self.bind_exec(data_shapes, label_shapes, shared_group)
     File "/Users/hypergroups/anaconda2/lib/python2.7/site-packages/mxnet/module/executor_group.py", line 361, in bind_exec
       shared_group))
     File "/Users/hypergroups/anaconda2/lib/python2.7/site-packages/mxnet/module/executor_group.py", line 639, in _bind_ith_exec
       shared_buffer=shared_data_arrays, **input_shapes)
     File "/Users/hypergroups/anaconda2/lib/python2.7/site-packages/mxnet/symbol/symbol.py", line 1519, in simple_bind
       raise RuntimeError(error_msg)
   RuntimeError: simple_bind error. Arguments:
   Input: (1, 2)
   [19:44:03] src/executor/graph_executor.cc:456: 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   libmxnet.so                         0x00000001065513b4 libmxnet.so + 21428
   [bt] (1) 1   libmxnet.so                         0x000000010655116f libmxnet.so + 20847
   [bt] (2) 2   libmxnet.so                         0x00000001076123a4 MXNDListFree + 188484
   [bt] (3) 3   libmxnet.so                         0x000000010761d9a7 MXNDListFree + 235079
   [bt] (4) 4   libmxnet.so                         0x000000010762116a MXNDListFree + 249354
   [bt] (5) 5   libmxnet.so                         0x00000001075b19b0 MXExecutorSimpleBind + 8656
   [bt] (6) 6   libffi.6.dylib                      0x0000000104898884 ffi_call_unix64 + 76
   [bt] (7) 7   ???                                 0x00007ffeeb6ddd10 0x0 + 140732848266512
   
   
   
   Process finished with exit code 1
   
   ```
   ### Without lstm
   
   code verson
   'wolfram/v1/wolfram.no_lstm.py'
   'wolfram/v1/wolfram.no_lstm.py'
   'wolfram/v2/wolfram.no_lstm.py'
   can give the correct results.
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services