Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Is it possible to load pytorch model (.pth)? #13

Open
theheena opened this issue Oct 31, 2017 · 4 comments
Open

Is it possible to load pytorch model (.pth)? #13

theheena opened this issue Oct 31, 2017 · 4 comments

Comments

@theheena
Copy link

Hi,
I have a pytorch pre-trained model (.pth) for neural art style. Is it possible to convert this model into mlmodel?

@opedge
Copy link
Member

opedge commented Oct 31, 2017

Hi @theheena ,
Although torch7 and pytorch seem similar, models are not compatible with each other. Only torch7 -> pytorch (legacy.nn) is suitable for conversion. But not vice versa. Thus it is not possible to convert .pth pre-trained pytorch model.

@theheena
Copy link
Author

theheena commented Nov 2, 2017

Hi @opedge ,

Thank you for your answer.

@theheena
Copy link
Author

theheena commented Nov 2, 2017

Hi @opedge ,

I have one more question regarding the training of new model. In the fast-neural-style folder, their is a file called DataLoader.lua which contains following lines,

self.image_paths = {
train = '/train2014/images',
val = '/val2014/images',
}

Is that the train and val are paths to the training and validation images? This file also takes in input .h5 file which is already being created with the train and validation images.

I got following error,
/fast_neural_style/DataLoader.lua:38: attempt to call method 'dataspaceSize' (a nil value)

I think this is due to the path specified in self.image_paths. Please let me know if it is the solution.

@opedge
Copy link
Member

opedge commented Nov 2, 2017

Hi @theheena ,
I think DataLoader.lua is intended for training model. torch2coreml can convert only already trained model into CoreML for inference on mobile device.
I don't know exactly about internal structure of DataLoader.lua.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants