MMdnn icon indicating copy to clipboard operation
MMdnn copied to clipboard

How to Converting pre-trained pytorch model to MXNet?

Open Ken1256 opened this issue 6 years ago • 2 comments

Platform (like ubuntu 16.04/win10):win10

Python version:3.6.6 x64

Source framework with version (like Tensorflow 1.4.1 with GPU):torch-0.4.1-cp36-cp36m-win_amd64 (CUDA 9.2)

Destination framework with version (like CNTK 2.3 with GPU):mxnet-cu92 --pre(1.3.1b20180927)

Pre-trained model path (webpath or webdisk path): http://xinyizhang.tech/files/GFN_epoch_55.pkl.zip https://github.com/jacquelinelala/GFN

Running scripts: mmconvert -sf "pytorch" -in Z:\sp2\GFN\GFN-master\models\GFN_epoch_55.pkl --inputShape 3,256,256 -df "mxnet" -om "F:\test.params"

error: Traceback (most recent call last): File "c:\program files\python36\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\program files\python36\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "C:\Program Files\Python36\Scripts\mmconvert.exe_main.py", line 9, in File "c:\program files\python36\lib\site-packages\mmdnn\conversion_script\convert.py", line 102, in _main ret = convertToIR._convert(ir_args) File "c:\program files\python36\lib\site-packages\mmdnn\conversion_script\convertToIR.py", line 92, in _convert parser = PytorchParser(model, inputshape[0]) File "c:\program files\python36\lib\site-packages\mmdnn\conversion\pytorch\pytorch_parser.py", line 76, in init model = torch.load(model_file_name, map_location='cpu') File "c:\program files\python36\lib\site-packages\torch\serialization.py", line 358, in load return _load(f, map_location, pickle_module) File "c:\program files\python36\lib\site-packages\torch\serialization.py", line 542, in _load result = unpickler.load() ModuleNotFoundError: No module named 'networks'

Ken1256 avatar Oct 31 '18 01:10 Ken1256

I don't know how to get inputShape value, just guess...

Ken1256 avatar Oct 31 '18 01:10 Ken1256

Hi,did you solve it? xxx.pth convert xxx.params

kirkzZ avatar Nov 22 '21 08:11 kirkzZ