NervanaSystems / neon

Intel® Nervana™ reference deep learning framework committed to best performance on all hardware
http://neon.nervanasys.com/docs/latest
Apache License 2.0
3.87k stars 811 forks source link

Convert v1 model file to current version #440

Closed jannepy closed 6 years ago

jannepy commented 6 years ago

We have an older Neon v1 model which we'd like to use with the latest Neon version. However, the model loading fails due to this assert: File "neon/neon/layers/container.py", line 200, in load_weight assert len(pdict['config']['layers']) == len(self.layers)

This same issue has been reported with the pre-trained deep speech model: https://github.com/NervanaSystems/deepspeech/issues/63

Is there a way to convert the old v1 model to work with the latest Neon?

wei-v-wang commented 6 years ago

What do you mean by "v1 model" ? Which model is that. Is that DeepSpeech model and was it used to work with an older neon version?

jannepy commented 6 years ago

It is based on the DeepSpeech model, and it has been trained with Neon 1.8. It appears that the models serialized with the old 1.* versions are no longer compatible with the latest Neon. Is there some way to convert those models such that they can be used with version 2.6?

wei-v-wang commented 6 years ago

neon 2.3+ versions should be able to load the model trained in neon 1.8, and re-save it in neon 2.3+ format.

Please see this issue: https://github.com/NervanaSystems/neon/issues/415 and please pay attention to the comment that "i was able to load and save the new model by printing out the model architecture and verifying that the structure of the layers where equal".

jannepy commented 6 years ago

I followed the instructions in #415, and by reconstructing the layers I was able to load the model into Neon 2.6 and save in the new format. Thanks!