Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

SymbolBlock.imports ignore_extra & allow_missing #19156

Merged
merged 2 commits into from
Sep 17, 2020

Conversation

samskalicky
Copy link
Contributor

@samskalicky samskalicky commented Sep 15, 2020

Description

Backport of #19157. 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

@mxnet-bot
Copy link

Hey @samskalicky , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [miscellaneous, windows-cpu, windows-gpu, website, sanity, centos-gpu, unix-cpu, clang, edge, centos-cpu, unix-gpu]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

@leezu leezu merged commit 837c7e4 into apache:v1.x Sep 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants