{"action":"created","issue":{"url":"https://api.github.com/repos/bartvm/blocks/issues/579","labels_url":"https://api.github.com/repos/bartvm/blocks/issues/579/labels{/name}","comments_url":"https://api.github.com/repos/bartvm/blocks/issues/579/comments","events_url":"https://api.github.com/repos/bartvm/blocks/issues/579/events","html_url":"https://github.com/bartvm/blocks/pull/579","id":66219751,"number":579,"title":"Custom picklers","user":{"login":"bartvm","id":2299595,"avatar_url":"https://avatars.githubusercontent.com/u/2299595?v=3","gravatar_id":"","url":"https://api.github.com/users/bartvm","html_url":"https://github.com/bartvm","followers_url":"https://api.github.com/users/bartvm/followers","following_url":"https://api.github.com/users/bartvm/following{/other_user}","gists_url":"https://api.github.com/users/bartvm/gists{/gist_id}","starred_url":"https://api.github.com/users/bartvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartvm/subscriptions","organizations_url":"https://api.github.com/users/bartvm/orgs","repos_url":"https://api.github.com/users/bartvm/repos","events_url":"https://api.github.com/users/bartvm/events{/privacy}","received_events_url":"https://api.github.com/users/bartvm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-04-03T20:07:55Z","updated_at":"2015-04-06T12:48:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bartvm/blocks/pulls/579","html_url":"https://github.com/bartvm/blocks/pull/579","diff_url":"https://github.com/bartvm/blocks/pull/579.diff","patch_url":"https://github.com/bartvm/blocks/pull/579.patch"},"body":"This is basically a cleaned up version of @abergeron's custom picklers from Pynnet, but now with ~~support for `CudaNdarray` and~~ intelligent naming of arrays that belong to shared variables. So far there is no Blocks-specific functionality in here yet, which makes me wonder whether maybe this would be considered useful enough to add to Theano instead of Blocks (@lamblin, @nouiz?). Almost everyone ends up saving their model's parameters to NumPy files one way or the other, and I think this is a nicely transparent way to do it.\r\n\r\nIllustrative use from the docstring:\r\n\r\n```python\r\n>>> import theano\r\n>>> foo_1 = theano.shared(0, name='foo')\r\n>>> foo_2 = theano.shared(1, name='foo')\r\n>>> with open('model.zip', 'w') as f:\r\n...     dump((foo_1, foo_2, numpy.array(2)), f)\r\n>>> numpy.load('model.zip').keys()\r\n['foo', 'foo_2', 'array_0', 'pkl']\r\n>>> numpy.load('model.zip')['foo']\r\narray(0)\r\n>>> with open('model.zip') as f:\r\n...     foo_1, foo_2, array = load(f)\r\n>>> array\r\narray(2)\r\n```\r\n\r\nThe plan for Blocks is now to basically extend `PersistentSharedVariableID` to a `PersistentBrickParameterID`, which names the arrays not only after the shared variable, but also taking into account its position in the Brick hierarchy (and hence fixing #474).\r\n\r\nCC @dmitriy-serdyuk "},"comment":{"url":"https://api.github.com/repos/bartvm/blocks/issues/comments/90048336","html_url":"https://github.com/bartvm/blocks/pull/579#issuecomment-90048336","issue_url":"https://api.github.com/repos/bartvm/blocks/issues/579","id":90048336,"user":{"login":"rizar","id":654434,"avatar_url":"https://avatars.githubusercontent.com/u/654434?v=3","gravatar_id":"","url":"https://api.github.com/users/rizar","html_url":"https://github.com/rizar","followers_url":"https://api.github.com/users/rizar/followers","following_url":"https://api.github.com/users/rizar/following{/other_user}","gists_url":"https://api.github.com/users/rizar/gists{/gist_id}","starred_url":"https://api.github.com/users/rizar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rizar/subscriptions","organizations_url":"https://api.github.com/users/rizar/orgs","repos_url":"https://api.github.com/users/rizar/repos","events_url":"https://api.github.com/users/rizar/events{/privacy}","received_events_url":"https://api.github.com/users/rizar/received_events","type":"User","site_admin":false},"created_at":"2015-04-06T12:48:08Z","updated_at":"2015-04-06T12:48:08Z","body":"I did my homework reading pickle docs and now I like this idea. But the current state of the PR looks somewhat raw, in particular I guess we want to keep all the custom pickling error messages we had. "}}