{"action":"created","issue":{"url":"https://api.github.com/repos/dmlc/mxnet/issues/362","labels_url":"https://api.github.com/repos/dmlc/mxnet/issues/362/labels{/name}","comments_url":"https://api.github.com/repos/dmlc/mxnet/issues/362/comments","events_url":"https://api.github.com/repos/dmlc/mxnet/issues/362/events","html_url":"https://github.com/dmlc/mxnet/issues/362","id":112739233,"number":362,"title":"[R] Consider make model structure compatible with Rdata","user":{"login":"tqchen","id":2577440,"avatar_url":"https://avatars.githubusercontent.com/u/2577440?v=3","gravatar_id":"","url":"https://api.github.com/users/tqchen","html_url":"https://github.com/tqchen","followers_url":"https://api.github.com/users/tqchen/followers","following_url":"https://api.github.com/users/tqchen/following{/other_user}","gists_url":"https://api.github.com/users/tqchen/gists{/gist_id}","starred_url":"https://api.github.com/users/tqchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tqchen/subscriptions","organizations_url":"https://api.github.com/users/tqchen/orgs","repos_url":"https://api.github.com/users/tqchen/repos","events_url":"https://api.github.com/users/tqchen/events{/privacy}","received_events_url":"https://api.github.com/users/tqchen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dmlc/mxnet/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/dmlc/mxnet/labels/R-Package","name":"R-Package","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-22T06:23:30Z","updated_at":"2015-11-18T18:05:16Z","closed_at":null,"body":"Currently most things are Rcpp based, which means things are not compatible with Rdata. Due to the limitation of current R's serialization system without a customized loading function.\r\n\r\nThe only way to make things Rdata compatible is to eagerly dump state into raw state every-time a new object is returned, and in all functions, check externalptr, if it is null, load things from the raw state. This is how things are handled in xgboost.\r\n\r\nSuch way is dumb, and cost a lot of overhead and do not make sense for low level API. However, it might be possible to support this way for https://github.com/dmlc/mxnet/blob/master/R-package/R/model.R#L71 model structure. So at least user can save the model in Rdata, while things still won't be perfect, this might be helpful.\r\n\r\nThis is not an urgent thing, but maybe worth considering\r\n"},"comment":{"url":"https://api.github.com/repos/dmlc/mxnet/issues/comments/157804432","html_url":"https://github.com/dmlc/mxnet/issues/362#issuecomment-157804432","issue_url":"https://api.github.com/repos/dmlc/mxnet/issues/362","id":157804432,"user":{"login":"tqchen","id":2577440,"avatar_url":"https://avatars.githubusercontent.com/u/2577440?v=3","gravatar_id":"","url":"https://api.github.com/users/tqchen","html_url":"https://github.com/tqchen","followers_url":"https://api.github.com/users/tqchen/followers","following_url":"https://api.github.com/users/tqchen/following{/other_user}","gists_url":"https://api.github.com/users/tqchen/gists{/gist_id}","starred_url":"https://api.github.com/users/tqchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tqchen/subscriptions","organizations_url":"https://api.github.com/users/tqchen/orgs","repos_url":"https://api.github.com/users/tqchen/repos","events_url":"https://api.github.com/users/tqchen/events{/privacy}","received_events_url":"https://api.github.com/users/tqchen/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T18:05:16Z","updated_at":"2015-11-18T18:05:16Z","body":"It is never hard to explicit save something that is serializable in Rdata form.  We have ways to save graph to json string, and ndarrays(parameters) to raw type in R. \r\n\r\nProblem is on eagerly saving things to object everytime an object is generated. Which could be costly for object such as array(means need to dump things from GPU to CPU everytime an operation is calculated).\r\n\r\n- This eager saving approach may not be too bad for model object, since model is rather costly to build.\r\n- It will also work if the upper level tool calling mx provide some explicit wrapper that calls the save.to.robject, load.from.robject.\r\n"}}