prisma-ai/torch2coreml

Error while trying to create coreml model

Closed this issue · 1 comments

I have followed all the instructions to create a model from "http://cs.stanford.edu/people/jcjohns/fast-neural-style/models/instance_norm/mosaic.t7"
I have created my own style model, but when I tried to convert to coreml, I am getting this error.
I thought my model file is wrong, but I dowloaded this file "http://cs.stanford.edu/people/jcjohns/fast-neural-style/models/instance_norm/mosaic.t7" and tried with that. The result is same. No luck.
Could you provide me a solution to fix that?

Traceback (most recent call last):
File "convert-fast-neural-style.py", line 175, in
main()
File "convert-fast-neural-style.py", line 161, in main
unknown_layer_converter_fn=convert_instance_norm
File "/usr/local/lib/python2.7/dist-packages/torch2coreml/_torch_converter.py", line 192, in convert
with torch.legacy.nn.Sequential module as root"
TypeError: Model must be file path to .t7 file or pytorch loaded model with torch.legacy.nn.Sequential module as root

I have found a solution, I am able to create core ml model by using this script. https://github.com/prisma-ai/torch2coreml/blob/master/example/fast-neural-style/prepare_model.lua

Thank you