NervanaSystems / ModelZoo

neon model zoo
Apache License 2.0
176 stars 69 forks source link

Image classification topologies corrected for Neon 2.2 and Neon 2.3 #24

Open tpatejko opened 6 years ago

tpatejko commented 6 years ago

All_cnn, Alexnet, Googlenet and Alexnet work with Neon 2.3 and Aeon 1.0. DeepResnet works with Neon 2.2 due to errors related to bias fusion (?)

tpatejko commented 6 years ago

DeepResnet on Neon 2.3 gives the following error:

File"resnet_eval.py", line 63, in model = Model(load_obj(args.model_file), weights_only=True) File "/home/tpatejko/_aeon/ModelZoo/neon_2.3/neon/models/model.py", line 70, in init self.deserialize(layers, load_states=(not weights_only)) File "/home/tpatejko/_aeon/ModelZoo/neon_2.3/neon/models/model.py", line 475, in deserialize self.layers.load_weights(model_dict['model'], load_states) File "/home/tpatejko/_aeon/ModelZoo/neon_2.3/neon/layers/container.py", line 202, in load_weights branch.load_weights(bdict, load_states=load_states) File "/home/tpatejko/_aeon/ModelZoo/neon_2.3/neon/layers/container.py", line 202, in load_weights branch.load_weights(bdict, load_states=load_states) File "/home/tpatejko/_aeon/ModelZoo/neon_2.3/neon/layers/container.py", line 198, in load_weights pdict['config']['layers'] = self.fusion_pass(pdict['config']['layers']) File "/home/tpatejko/_aeon/ModelZoo/neon_2.3/neon/layers/container.py", line 177, in fusion_pass if any([pattern(l1, l2) for pattern in patterns]): File "/home/tpatejko/_aeon/ModelZoo/neon_2.3/neon/layers/container.py", line 172, in y['type'] == 'neon.layers.layer.Bias'] TypeError: 'NoneType' object has no attribute 'getitem'

wei-v-wang commented 6 years ago

Thanks @tpatejko for the PR. Regarding DeepResnet failure, could you please try the code pattern discussed in https://github.com/NervanaSystems/neon/issues/415 ? i.e. can you try to re-write Model(load_obj(args.model_file), load_states) to Model (...) model.load_params(args.model_file, load_states)?

Also, could you please take a look at https://github.com/NervanaSystems/modelzoo/tree/VGG_neon2.3 to merge the best ingredients of the two for VGG?

Thank you!

tpatejko commented 6 years ago

@wei-v-wang Thanks for your comment

I tried to change the script following your remarks but I have a problem with the following part of code:

Model (...) model.load_params(args.model_file, load_states)

but I'm not quite sure how to initialize Model part. I tried to use code that builds model in file resnet_cifar10.py but I encountered the following error:

File "/home/tpatejko/_aeon/ModelZoo/neon_2.3/neon/layers/container.py", line 200, in load_weights assert len(pdict['config']['layers']) == len(self.layers)

Another question: could you elaborate on what you mean by merging best ingredients of two for VGG?

wei-v-wang commented 6 years ago

@tpatejko Sorry I must have missed your comments above.

I will take a look at the resnet_eval failure.

For VGG, I just create a PR to modelZoo as well. https://github.com/NervanaSystems/ModelZoo/pull/25

Thanks!

wei-v-wang commented 6 years ago

@tpatejko Can you please work on uploading the new formatted weight files to aws first?