-1
$\begingroup$

How to import mathematica trained mxnet neural net into python and use it there?

Can someone provide a simple example i can use as a template.

Thanks

$\endgroup$
  • $\begingroup$ Related: mathematica.stackexchange.com/q/151328/242 $\endgroup$ – Niki Estner Oct 28 '18 at 20:27
  • $\begingroup$ who down-voted my question. please provide comment also if you down vote. $\endgroup$ – user13892 Nov 9 '18 at 18:22
  • $\begingroup$ I didn't downvote, but I can guess why: I've had to solve a similar problem (import mxnet into C++). Based on the question I've linked it was doable, but it took some trial and error and a lot of work. Your question seems to ask others to do this work for you, for free, with no effort from you. If you want your problem solved, it's better to solve as much of it yourself as you can, then ask specific questions when you're stuck. And ideally, post your working sample as an answer to your own question in the end ;-) $\endgroup$ – Niki Estner Nov 9 '18 at 20:15
2
$\begingroup$

When you export the model, you will get a "json" and "params" file. You can then follow these steps to load the files and import the model into Python:

sym, arg_params, aux_params = mx.model.load_checkpoint(model_prefix, 3)
assert sym.tojson() == net.tojson()
mod.set_params(arg_params, aux_params)  

http://mxnet.incubator.apache.org/tutorials/basic/module.html#save-and-load

$\endgroup$
  • $\begingroup$ Thank for the answer but it appears to be a checkpoint system for the training that was performed on python. Can you please define what to put in model_prefex. And where to define the path to the file. $\endgroup$ – user13892 Oct 31 '18 at 8:39
  • $\begingroup$ If possible create a trivial neural net in mathematica and NetInitialize it to give it random parameters and then import using the syntax you are describing. $\endgroup$ – user13892 Oct 31 '18 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.