Loaded pretrained model but train accuracy starts from zero, #15496
Replies: 7 comments
-
|
@mxnet-label-bot add [python, question] |
Beta Was this translation helpful? Give feedback.
-
|
Hey @KhurramPirov, thank you for asking the question. |
Beta Was this translation helpful? Give feedback.
-
|
Below code should work model.save_checkpoint('model', epoch = 0)
sym, arg_params, aux_params = mx.model.load_checkpoint('model', epoch = 0)
model = mx.mod.Module(sym, context = mx.gpu())
model.bind(data_shapes = train_data.provide_data, label_shapes = train_data.provide_label)
model.set_params(arg_params, aux_params) |
Beta Was this translation helpful? Give feedback.
-
|
It doesn't work inside batch_callback and model.fit.
пт, 12 июл. 2019 г. в 14:08, Rishik Mourya <notifications@github.com>:
… Below code should work
model.save_checkpoint('model', epoch = 0)
sym, arg_params, aux_params = mx.model.load_checkpoint('model', epoch = 0)
model = mx.mod.Module(sym, context = mx.gpu())
model.bind(data_shapes = train_data.provide_data, label_shapes = train_data.provide_label)
model.set_params(arg_params, aux_params)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/apache/incubator-mxnet/issues/15496?email_source=notifications&email_token=AH2IALWXSFZS2HGDQC5XVTLP7BQ3HA5CNFSM4H7EN2K2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZZOQQQ#issuecomment-510847042>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AH2IALUDS2I4EIDGSB4CI5TP7BQ3HANCNFSM4H7EN2KQ>
.
--
Khurram Pirov
skype: matrixrextended
mob: +7-916-439-53-76
|
Beta Was this translation helpful? Give feedback.
-
|
Hi! I attached an example for mnist_code, just train for some checkpoint
and then try to load it. All in the notebook, I can't get the same
accuracy after loading from checkpoints. Please check my notebook. The same
bug is in my main code.
пт, 12 июл. 2019 г. в 14:08, Rishik Mourya <notifications@github.com>:
… Below code should work
model.save_checkpoint('model', epoch = 0)
sym, arg_params, aux_params = mx.model.load_checkpoint('model', epoch = 0)
model = mx.mod.Module(sym, context = mx.gpu())
model.bind(data_shapes = train_data.provide_data, label_shapes = train_data.provide_label)
model.set_params(arg_params, aux_params)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/apache/incubator-mxnet/issues/15496?email_source=notifications&email_token=AH2IALWXSFZS2HGDQC5XVTLP7BQ3HA5CNFSM4H7EN2K2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZZOQQQ#issuecomment-510847042>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AH2IALUDS2I4EIDGSB4CI5TP7BQ3HANCNFSM4H7EN2KQ>
.
--
Khurram Pirov
skype: matrixrextended
mob: +7-916-439-53-76
|
Beta Was this translation helpful? Give feedback.
-
|
And pyfile
пн, 15 июл. 2019 г. в 15:21, Пиров Хуррам Хуршедович <
khurram.pirov@phystech.edu>:
… Hi! I attached an example for mnist_code, just train for some checkpoint
and then try to load it. All in the notebook, I can't get the same
accuracy after loading from checkpoints. Please check my notebook. The same
bug is in my main code.
пт, 12 июл. 2019 г. в 14:08, Rishik Mourya ***@***.***>:
> Below code should work
>
> model.save_checkpoint('model', epoch = 0)
>
> sym, arg_params, aux_params = mx.model.load_checkpoint('model', epoch = 0)
>
> model = mx.mod.Module(sym, context = mx.gpu())
> model.bind(data_shapes = train_data.provide_data, label_shapes = train_data.provide_label)
> model.set_params(arg_params, aux_params)
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/incubator-mxnet/issues/15496?email_source=notifications&email_token=AH2IALWXSFZS2HGDQC5XVTLP7BQ3HA5CNFSM4H7EN2K2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZZOQQQ#issuecomment-510847042>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AH2IALUDS2I4EIDGSB4CI5TP7BQ3HANCNFSM4H7EN2KQ>
> .
>
--
Khurram Pirov
skype: matrixrextended
mob: +7-916-439-53-76
--
Khurram Pirov
skype: matrixrextended
mob: +7-916-439-53-76
|
Beta Was this translation helpful? Give feedback.
-
|
Here is your working solution notebook. Ask me anything if you've further doubts.(Yes I'm mouryarishik) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I loaded pretrained model, but got zero train accuracy (acc) at the same time pretrained model has 80% accuracy.
Can I do like this?
`sym, arg_params, aux_params = mx.model.load_checkpoint(os.path.join(args.pretrained, "model"), args.pretrained_epoch)
sym = get_symbol(args)
model = mx.mod.Module(symbol=sym, label_names=None, context=ctx)
model = mx.mod.Module(symbol=sym, context=ctx, label_names=None)
model.bind(for_training=True, data_shapes=[('data', (600, 3, 112, 112))],
label_shapes=model._label_shapes)
Error:
RuntimeError: simple_bind error. Arguments:
data: (100, 3, 112, 112)
Error in operator one_hot0: [15:14:19] src/operator/tensor/./indexing_op.h:1193: Check failed: (*in_attrs)[0] != -1 (-1 vs. -1) Index type must be set for one_hot operator
Beta Was this translation helpful? Give feedback.
All reactions