{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/3964","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/3964/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/3964/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/3964/events","html_url":"https://github.com/fchollet/keras/issues/3964","id":180981664,"number":3964,"title":"load_model fails to load optimizer","user":{"login":"RaffEdwardBAH","id":5190184,"avatar_url":"https://avatars2.githubusercontent.com/u/5190184?v=3","gravatar_id":"","url":"https://api.github.com/users/RaffEdwardBAH","html_url":"https://github.com/RaffEdwardBAH","followers_url":"https://api.github.com/users/RaffEdwardBAH/followers","following_url":"https://api.github.com/users/RaffEdwardBAH/following{/other_user}","gists_url":"https://api.github.com/users/RaffEdwardBAH/gists{/gist_id}","starred_url":"https://api.github.com/users/RaffEdwardBAH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RaffEdwardBAH/subscriptions","organizations_url":"https://api.github.com/users/RaffEdwardBAH/orgs","repos_url":"https://api.github.com/users/RaffEdwardBAH/repos","events_url":"https://api.github.com/users/RaffEdwardBAH/events{/privacy}","received_events_url":"https://api.github.com/users/RaffEdwardBAH/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2016-10-04T19:23:59Z","updated_at":"2017-06-23T07:51:15Z","closed_at":null,"body":"Please make sure that the boxes below are checked before you submit your issue. Thank you!\n- [X] Check that you are up-to-date with the master branch of Keras. You can update with:\n  pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps\n- [X] If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with:\n  pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps\n- [ ] Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).\n\nNot sure what the specific cause is yet and how to isolate it, but I'm having some issues using the `load_model`  method. I get the below error complaining about weight shape for the optimizer. \n\n```\n---------------------------------------------------------------------------\nException                                 Traceback (most recent call last)\n<ipython-input-7-946052120828> in <module>()\n      7 \n      8 if args.model_js == \"\":\n----> 9     model = load_model(args.model_h5, custom_layer_dict)\n     10 else:\n     11     model = model_from_json(open(args.model_js).read(), custom_layer_dict)\n\n/usr/local/lib/python2.7/dist-packages/keras/models.pyc in load_model(filepath, custom_objects)\n    165         optimizer_weight_names = [n.decode('utf8') for n in optimizer_weights_group.attrs['weight_names']]\n    166         optimizer_weight_values = [optimizer_weights_group[n] for n in optimizer_weight_names]\n--> 167         model.optimizer.set_weights(optimizer_weight_values)\n    168     f.close()\n    169     return model\n\n/usr/local/lib/python2.7/dist-packages/keras/optimizers.pyc in set_weights(self, weights)\n     95                                 str(pv.shape) +\n     96                                 ' not compatible with '\n---> 97                                 'provided weight shape ' + str(w.shape))\n     98             weight_value_tuples.append((p, w))\n     99         K.batch_set_value(weight_value_tuples)\n\nException: Optimizer weight shape (11, 1, 188, 208) not compatible with provided weight shape (208, 188, 11, 1)\n```\n\nimage ordering does not impact this. The model has some 1D convolutions, fully connected layers, merging, and some custom layers. If I instead use `model_from_json` and them call `load_weights` then no problem occurs. \n"},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/310597554","html_url":"https://github.com/fchollet/keras/issues/3964#issuecomment-310597554","issue_url":"https://api.github.com/repos/fchollet/keras/issues/3964","id":310597554,"user":{"login":"tstandley","id":17170654,"avatar_url":"https://avatars1.githubusercontent.com/u/17170654?v=3","gravatar_id":"","url":"https://api.github.com/users/tstandley","html_url":"https://github.com/tstandley","followers_url":"https://api.github.com/users/tstandley/followers","following_url":"https://api.github.com/users/tstandley/following{/other_user}","gists_url":"https://api.github.com/users/tstandley/gists{/gist_id}","starred_url":"https://api.github.com/users/tstandley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tstandley/subscriptions","organizations_url":"https://api.github.com/users/tstandley/orgs","repos_url":"https://api.github.com/users/tstandley/repos","events_url":"https://api.github.com/users/tstandley/events{/privacy}","received_events_url":"https://api.github.com/users/tstandley/received_events","type":"User","site_admin":false},"created_at":"2017-06-23T07:51:15Z","updated_at":"2017-06-23T07:51:15Z","body":"@sakvaua Thanks. You're awesome! Wish I knew about this sooner."}}
{"actor":{"display_login":"tstandley"}}