Saved model and then looked at the output of the same batch after loading, got different results! #15504
Replies: 6 comments
-
@mxnet-label-bot add [question, training] |
Beta Was this translation helpful? Give feedback.
-
@KhurramPirov It looks you like you are running all batched data from data_iter for the initial forward, |
Beta Was this translation helpful? Give feedback.
-
@frankfliu |
Beta Was this translation helpful? Give feedback.
-
Make sure you are saving and loading the model from the same path. I've tested the code below and it is working fine. for batch in data_iter:
model.forward(batch)
out1 = model.get_outputs()[0]
break
model.save_checkpoint('model', epoch = 0)
sym, arg_params, aux_params = mx.model.load_checkpoint('model', epoch = 0)
model.set_params(arg_params, aux_params)
model.forward(batch)
out2 = model.get_outputs()[0]
print(f'diff_output:{nd.abs(out1 - out2)}') Output is all zeros. |
Beta Was this translation helpful? Give feedback.
-
I checked the path, I do it inside batch_callback and model.fit, can it be
the case(seems no), but nevetheless.
пт, 12 июл. 2019 г. в 13:03, Rishik Mourya <[email protected]>:
… Make sure you are saving and loading the model from the same path. I've
tested the code below and it is working fine.
for batch in data_iter:
model.forward(batch)
out1 = model.get_outputs()[0]
break
model.save_checkpoint('model', epoch = 0)
sym, arg_params, aux_params = mx.model.load_checkpoint('model', epoch = 0)
model.set_params(arg_params, aux_params)
model.forward(batch)
out2 = model.get_outputs()[0]print(f'diff_output:{nd.abs(out1 - out2)}')
Output is all zeros.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/apache/incubator-mxnet/issues/15504?email_source=notifications&email_token=AH2IALW3CR6MZP532CKQ5ALP7BJFXA5CNFSM4H7SKOHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZZKIOA#issuecomment-510829624>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AH2IALTCG3VBAW5DDH2PFTLP7BJFXANCNFSM4H7SKOHA>
.
--
Khurram Pirov
skype: matrixrextended
mob: +7-916-439-53-76
|
Beta Was this translation helpful? Give feedback.
-
It doesn't work inside batch_callback.
пт, 12 июл. 2019 г. в 13:03, Rishik Mourya <[email protected]>:
… Make sure you are saving and loading the model from the same path. I've
tested the code below and it is working fine.
for batch in data_iter:
model.forward(batch)
out1 = model.get_outputs()[0]
break
model.save_checkpoint('model', epoch = 0)
sym, arg_params, aux_params = mx.model.load_checkpoint('model', epoch = 0)
model.set_params(arg_params, aux_params)
model.forward(batch)
out2 = model.get_outputs()[0]print(f'diff_output:{nd.abs(out1 - out2)}')
Output is all zeros.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/apache/incubator-mxnet/issues/15504?email_source=notifications&email_token=AH2IALW3CR6MZP532CKQ5ALP7BJFXA5CNFSM4H7SKOHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZZKIOA#issuecomment-510829624>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AH2IALTCG3VBAW5DDH2PFTLP7BJFXANCNFSM4H7SKOHA>
.
--
Khurram Pirov
skype: matrixrextended
mob: +7-916-439-53-76
|
Beta Was this translation helpful? Give feedback.
-
Description
(Brief description of the problem in no more than 2 sentences.)
Get different results from model which is saved and from loaded model.
I tried differen methods for saving and loading, all showed wrong output.
Beta Was this translation helpful? Give feedback.
All reactions