pytorch-CycleGAN-and-pix2pix icon indicating copy to clipboard operation
pytorch-CycleGAN-and-pix2pix copied to clipboard

How to convert trained CycleGAN model to ONNX, eventually coreML model

Open HeoJinLareine opened this issue 5 years ago • 8 comments

Thank's to you, I've achieved my goal through your cycleGAN model.

I hope to convert cycleGAN model to ONNX model, eventually coreML model.

On your code, which file should I try convert?

And any advice how to do it?

Once again, I'm really thanks to you!

HeoJinLareine avatar Nov 20 '19 11:11 HeoJinLareine

Hi HeoJinLareine,

We tried to convert the CycleGAN model to ONNX but we got some problems:

First: TestModel object has no attribute ‘state_dict’

After changing the net into this attribute, we got: “forward() got an unexpected keyword argument: ‘keep_vars’” This seems to be a generic function call to neural networks, so it is a bit fuzzy to me which of the actual implementations is really called there (I would assume TestModel). However, I added this argument to all of those function definitions, but still get this error.

Did you try to do this? If so, can you share your solution?

Best regards, César Coelho

CesarCoelho avatar Jan 13 '20 14:01 CesarCoelho

Hi! I'm seeking to convert this model to ONNX too. I wouldn't even know where to start though.

rtolps avatar Dec 26 '20 04:12 rtolps

I as well!

Lia-C avatar Feb 13 '21 06:02 Lia-C

+1

Starkguava avatar Apr 16 '21 03:04 Starkguava

+1

tongchangD avatar May 23 '22 02:05 tongchangD

I am getting error as below

RuntimeError: Unsupported: ONNX export of batch_norm for unknown channel size.

tongchangD avatar May 25 '22 08:05 tongchangD

+1

youjin-c avatar Aug 05 '22 09:08 youjin-c

+1

You can fix this error by compiling and installing PyTorch yourself

tongchangD avatar Aug 10 '22 00:08 tongchangD