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

added check for empty params file and unknown param (not arg/aux) #15917

Merged
merged 7 commits into from
Aug 16, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions python/mxnet/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,18 @@ def load_checkpoint(prefix, epoch):
save_dict = nd.load('%s-%04d.params' % (prefix, epoch))
arg_params = {}
aux_params = {}
for k, v in save_dict.items():
tp, name = k.split(':', 1)
if tp == 'arg':
arg_params[name] = v
if tp == 'aux':
aux_params[name] = v
#load any params in the dict, skip if params are empty
if(save_dict):
for k, v in save_dict.items():
tp, name = k.split(':', 1)
if tp == 'arg':
arg_params[name] = v
elif tp == 'aux':
aux_params[name] = v
else:
logging.warning("Params file '%s' contains unknown param '%s'" %
('%s-%04d.params' % (prefix, epoch),
k))
return (symbol, arg_params, aux_params)

from .callback import LogValidationMetricsCallback # pylint: disable=wrong-import-position
Expand Down