samskalicky opened a new pull request #19157:
URL: https://github.com/apache/incubator-mxnet/pull/19157
## Description ##
Allow `ignore_extra` and `allow_missing` to be specified in
`SymbolBlock.imports` for loading params.
Allows users to actually act on the error message:
```
Traceback (most recent call last):
File "/home/ubuntu/runtime.py", line 258, in __init__
self._model = mx.gluon.nn.SymbolBlock.imports(local_json_file_path,
[self.input_name], local_params_file_path, ctx=self.ctx)
File "/usr/local/lib/python3.6/dist-packages/mxnet/gluon/block.py", line
1365, in imports
ret.collect_params().load(param_file, ctx=ctx, cast_dtype=True,
dtype_source='saved')
File "/usr/local/lib/python3.6/dist-packages/mxnet/gluon/parameter.py",
line 1020, in load
ignore_extra, restore_prefix, filename, cast_dtype, dtype_source)
File "/usr/local/lib/python3.6/dist-packages/mxnet/gluon/parameter.py",
line 1066, in load_dict
name[lprefix:], error_str, _brief_print_list(self._params.keys()))
AssertionError: Parameter 'data' loaded from
file:gluon_cv_imagenet_classifier/ResNet18_v1/TVM/compiled-0000.params is not
present in ParameterDict, choices are: 'resnetv10_conv0_weight',
'resnetv10_batchnorm0_gamma', 'resnetv10_batchnorm0_beta', ...,
'resnetv10_stage4_batchnorm3_running_mean',
'resnetv10_stage4_batchnorm3_running_var',
'resnetv10_stage4_batchnorm4_running_mean',
'resnetv10_stage4_batchnorm4_running_var'. Set ignore_extra to True to ignore.
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
```
## Checklist ##
### Essentials ###
- [ ] PR's title starts with a category (e.g. [BUGFIX], [MODEL], [TUTORIAL],
[FEATURE], [DOC], etc)
- [ ] Changes are complete (i.e. I finished coding on this PR)
- [ ] All changes have test coverage
- [ ] Code is well-documented
### Changes ###
- [ ] Feature1, tests, (and when applicable, API doc)
- [ ] Feature2, tests, (and when applicable, API doc)
## Comments ##
- If this change is a backward incompatible change, why must this change be
made.
- Interesting edge cases to note here
----------------------------------------------------------------
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:
[email protected]