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 2020/04/21 05:41:02 UTC
[GitHub] [incubator-mxnet] lanking520 opened a new issue #18121: Error in Loading model that contains Sparse NDArray
lanking520 opened a new issue #18121:
URL: https://github.com/apache/incubator-mxnet/issues/18121
## Description
I am facing the issue loading the trained Symbolic model in mxnet 1.6.0. It is reproducible in the most recent nightly build. The error message indicated that the storage type in my model is not supported. My model is trained in 1.4.1 using Spare NDArray (RowSparse) as weight and Input type is CSR.
I tried to update the model to 1.6.0 and it didn't solve the problem. What should I do to use Sparse in 1.6.0?
This is partial information of my `symbol.json`
```
{
"nodes": [
{
"op": "null",
"name": "data",
"attrs": {"__storage_type__": "2"},
"inputs": []
},
{
"op": "null",
"name": "weight",
"attrs": {
"__init__": "[\"uniform\", {\"scale\": 0.01}]",
"__shape__": "(1000, 1024)",
"__storage_type__": "1"
},
"inputs": []
}
```
### Error Message
#### Using SymbolBlock to load:
```
imported_net = gluon.nn.SymbolBlock.imports(prefix + '-symbol.json', ['data'],
prefix + '-0000.params')
```
With error
```
line 1304, in __init__
"type is 'row_sparse'." % j.name
AssertionError: SymbolBlock doesn't support Parameter 'weight' because its storage type is 'row_sparse'.
```
#### Using Module API to load
```
mx.npx.set_np(True, True)
sym, arg_params, aux_params = mx.model.load_checkpoint(prefix, epoch=1)
```
with error
```
line 255, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [22:37:54] src/ndarray/ndarray.cc:1729: Check failed: Imperative::Get()->is_np_shape() == GlobalOn || !Imperative::Get()->is_np_shape(): ndarray was not saved in np shape semantics, but being loaded in np shape semantics. Please turn off np shape semantics in Python using `with np_shape(False)` to scope the code of loading the ndarray.
```
----------------------------------------------------------------
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
[GitHub] [incubator-mxnet] Tao-P-m commented on issue #18121: Error in Loading model that contains Sparse NDArray
Posted by GitBox <gi...@apache.org>.
Tao-P-m commented on issue #18121:
URL: https://github.com/apache/incubator-mxnet/issues/18121#issuecomment-903527123
Hi @lanking520 ,Do you have any solution about this error? I'm facing the same error now.
--
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