{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/258","labels_url":"https://api.github.com/repos/fchollet/keras/issues/258/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/258/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/258/events","html_url":"https://github.com/fchollet/keras/issues/258","id":89934317,"number":258,"title":"TypeError: can't pickle function objects, when applying regularizers","user":{"login":"bayesrule","id":3372671,"avatar_url":"https://avatars.githubusercontent.com/u/3372671?v=3","gravatar_id":"","url":"https://api.github.com/users/bayesrule","html_url":"https://github.com/bayesrule","followers_url":"https://api.github.com/users/bayesrule/followers","following_url":"https://api.github.com/users/bayesrule/following{/other_user}","gists_url":"https://api.github.com/users/bayesrule/gists{/gist_id}","starred_url":"https://api.github.com/users/bayesrule/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bayesrule/subscriptions","organizations_url":"https://api.github.com/users/bayesrule/orgs","repos_url":"https://api.github.com/users/bayesrule/repos","events_url":"https://api.github.com/users/bayesrule/events{/privacy}","received_events_url":"https://api.github.com/users/bayesrule/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-06-21T17:02:26Z","updated_at":"2015-08-25T17:49:24Z","closed_at":null,"body":"This happened when I added l1/l2 regularizer to a dense layer and intended to save the model with pickle. Many thanks."},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/134684008","html_url":"https://github.com/fchollet/keras/issues/258#issuecomment-134684008","issue_url":"https://api.github.com/repos/fchollet/keras/issues/258","id":134684008,"user":{"login":"fchollet","id":710255,"avatar_url":"https://avatars.githubusercontent.com/u/710255?v=3","gravatar_id":"","url":"https://api.github.com/users/fchollet","html_url":"https://github.com/fchollet","followers_url":"https://api.github.com/users/fchollet/followers","following_url":"https://api.github.com/users/fchollet/following{/other_user}","gists_url":"https://api.github.com/users/fchollet/gists{/gist_id}","starred_url":"https://api.github.com/users/fchollet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fchollet/subscriptions","organizations_url":"https://api.github.com/users/fchollet/orgs","repos_url":"https://api.github.com/users/fchollet/repos","events_url":"https://api.github.com/users/fchollet/events{/privacy}","received_events_url":"https://api.github.com/users/fchollet/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T17:49:24Z","updated_at":"2015-08-25T17:49:24Z","body":"@Imorton-zd you can simply do:\r\n\r\n```python\r\nmodel.save_weights(\"tmp.h5\")\r\njson_data = model.to_json()\r\n# later\r\nfrom keras.models import model_from_json\r\nmodel = model_from_json(json_data)\r\nmodel.load_weights(\"tmp.h5\")\r\n```"}}