MMdnn
MMdnn copied to clipboard
Converting pre-trained PyTorch model to MxNet
Platform (like ubuntu 16.04/win10): Ubuntu
Python version: Python 3.6
Source framework with version (like Tensorflow 1.4.1 with GPU): PyTorch
Destination framework with version (like CNTK 2.3 with GPU): MxNet
Hi @kitstar, I am willing to convert my pre-trained PyTorch model, based on Resnet152 architecture (not totally same as Resnet152) into MxNet model for deploying it on AWS Lambdas. I cannot find any examples or ways to do it. I believe you have worked on it. Can you please guide me through the process?
Awaiting your response.
Thank you.
Hi @dritidagli , I can search somthing about deployment of mxnet model for you, but I think the most convenient way for you is to search "Deploy MXNet models on AWS Lambda" on Google by yourself. Maybe it cost some time but it's quickier. maybe you can read this and see if it's helpful: https://aws.amazon.com/blogs/compute/seamlessly-scale-predictions-with-aws-lambda-and-mxnet/ Thanks!
Hi @namizzz, thank you for your response. I did look up for ways of deploying MXNet on AWS Lambdas and got a fair idea about doing it. The major issue that I am facing is that I am unable to convert my pre-trained PyTorch model into MXNet framework. When I try to run the command:
mmtoir -f pytorch -d resnetmyModel --inputShape 3 224 224 -n test.pth
It gives me the following error:
File "/home/ubuntu/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/mmdnn/conversion/pytorch/pytorch_parser.py", line 88, in gen_IR node_type = PytorchParser.layer_map[onnx_node_type] KeyError: 'onnx::Softmax'
On looking into the pytorch_parser.py file, I found that 'onnx::Softmax': convert_softmax is under the commented portion which says todo. So I believe that the convert_softmax method is not implemented. Could you tell me if it is possible for me to implement it? Or if there is some other way to go about it?
Thank you.
Hi @dritidagli , could you please provide your test.pth file?
Hi @namizzz, I am sorry but I cannot provide the test.pth file because of my company's proprietary issues. However, the main issue is that 'onnx::Softmax': convert_softmax has not been implemented. Could you tell me if it is possible for me to implement it? Or if there is some other way to go about it?
Thank you.
Hi @dritidagli Now we don't implement the 'onnx::Softmax' inpytorch parser, but you can do it by yourself. Here is Contribution Guideline, you can have a try! Here is the pytorch_parser .Fisrt add "'onnx::Softmax': softmax," to layer_map ,then add a 'rename_softmax' function.Thanks!
Hi,did you solve it? xxx.pth convert to xxx.params