Creating “.t7” torch file in python











up vote
0
down vote

favorite












By using pytorch, I can manage to save file like the following:



torch.save(object, "object.t7")


However, I cannot open it through Lua.



When I use the following command in Lua,



local info1 = torch.load("object.t7")


I receive the following error:




/home/hasan/build/torch/install/bin/luajit:
...an/build/torch/install/share/lua/5.1/threads/threads.lua:315:
...an/build/torch/install/share/lua/5.1/threads/threads.lua:183:
[thread 4 callback]
...e/hasan/build/torch/install/share/lua/5.1/torch/File.lua:375:
unknown object stack traceback: [C]: in function 'error'
...e/hasan/build/torch/install/share/lua/5.1/torch/File.lua:375: in
function 'readObject'
...e/hasan/build/torch/install/share/lua/5.1/torch/File.lua:409: in
function 'load'
/home/hasan/GAN/icml2016/data/donkey_folder_txt_coco.lua:112: in
function
[C]: in function 'xpcall'
...an/build/torch/install/share/lua/5.1/threads/threads.lua:234: in
function 'callback'
...asan/build/torch/install/share/lua/5.1/threads/queue.lua:65: in
function
<...asan/build/torch/install/share/lua/5.1/threads/queue.lua:41> [C]:
in function 'pcall'
...asan/build/torch/install/share/lua/5.1/threads/queue.lua:40: in
function 'dojob' [string " local Queue = require
'threads.queue'..."]:15: in main chunk




I need to run a torch training in Lua, with preprocessed data through Pytorch.



Is there any way to save ".t7" file via pytorch, and open it through Lua?



Thanks,










share|improve this question




















  • 1




    I'm not familia with Lua. But I guess the problem here is that PyTorch doesn't has it's own implementation for saving and loading the files. If you take a look at the source of torch.save you see that it's just one line relying on pythons pickle module (`cPickle for Python2). So you probably need to look for a way opening pickled files in Lua. Alternatively you could just try another way of saving and loading without pickle.
    – blue-phoenox
    Nov 8 at 9:10






  • 1




    I think did not point out the main problem really well: pickle is just an other python module. So Lua Torch has probably a completely different implementation for saving files and loading files, not based on pickle.
    – blue-phoenox
    Nov 8 at 12:16















up vote
0
down vote

favorite












By using pytorch, I can manage to save file like the following:



torch.save(object, "object.t7")


However, I cannot open it through Lua.



When I use the following command in Lua,



local info1 = torch.load("object.t7")


I receive the following error:




/home/hasan/build/torch/install/bin/luajit:
...an/build/torch/install/share/lua/5.1/threads/threads.lua:315:
...an/build/torch/install/share/lua/5.1/threads/threads.lua:183:
[thread 4 callback]
...e/hasan/build/torch/install/share/lua/5.1/torch/File.lua:375:
unknown object stack traceback: [C]: in function 'error'
...e/hasan/build/torch/install/share/lua/5.1/torch/File.lua:375: in
function 'readObject'
...e/hasan/build/torch/install/share/lua/5.1/torch/File.lua:409: in
function 'load'
/home/hasan/GAN/icml2016/data/donkey_folder_txt_coco.lua:112: in
function
[C]: in function 'xpcall'
...an/build/torch/install/share/lua/5.1/threads/threads.lua:234: in
function 'callback'
...asan/build/torch/install/share/lua/5.1/threads/queue.lua:65: in
function
<...asan/build/torch/install/share/lua/5.1/threads/queue.lua:41> [C]:
in function 'pcall'
...asan/build/torch/install/share/lua/5.1/threads/queue.lua:40: in
function 'dojob' [string " local Queue = require
'threads.queue'..."]:15: in main chunk




I need to run a torch training in Lua, with preprocessed data through Pytorch.



Is there any way to save ".t7" file via pytorch, and open it through Lua?



Thanks,










share|improve this question




















  • 1




    I'm not familia with Lua. But I guess the problem here is that PyTorch doesn't has it's own implementation for saving and loading the files. If you take a look at the source of torch.save you see that it's just one line relying on pythons pickle module (`cPickle for Python2). So you probably need to look for a way opening pickled files in Lua. Alternatively you could just try another way of saving and loading without pickle.
    – blue-phoenox
    Nov 8 at 9:10






  • 1




    I think did not point out the main problem really well: pickle is just an other python module. So Lua Torch has probably a completely different implementation for saving files and loading files, not based on pickle.
    – blue-phoenox
    Nov 8 at 12:16













up vote
0
down vote

favorite









up vote
0
down vote

favorite











By using pytorch, I can manage to save file like the following:



torch.save(object, "object.t7")


However, I cannot open it through Lua.



When I use the following command in Lua,



local info1 = torch.load("object.t7")


I receive the following error:




/home/hasan/build/torch/install/bin/luajit:
...an/build/torch/install/share/lua/5.1/threads/threads.lua:315:
...an/build/torch/install/share/lua/5.1/threads/threads.lua:183:
[thread 4 callback]
...e/hasan/build/torch/install/share/lua/5.1/torch/File.lua:375:
unknown object stack traceback: [C]: in function 'error'
...e/hasan/build/torch/install/share/lua/5.1/torch/File.lua:375: in
function 'readObject'
...e/hasan/build/torch/install/share/lua/5.1/torch/File.lua:409: in
function 'load'
/home/hasan/GAN/icml2016/data/donkey_folder_txt_coco.lua:112: in
function
[C]: in function 'xpcall'
...an/build/torch/install/share/lua/5.1/threads/threads.lua:234: in
function 'callback'
...asan/build/torch/install/share/lua/5.1/threads/queue.lua:65: in
function
<...asan/build/torch/install/share/lua/5.1/threads/queue.lua:41> [C]:
in function 'pcall'
...asan/build/torch/install/share/lua/5.1/threads/queue.lua:40: in
function 'dojob' [string " local Queue = require
'threads.queue'..."]:15: in main chunk




I need to run a torch training in Lua, with preprocessed data through Pytorch.



Is there any way to save ".t7" file via pytorch, and open it through Lua?



Thanks,










share|improve this question















By using pytorch, I can manage to save file like the following:



torch.save(object, "object.t7")


However, I cannot open it through Lua.



When I use the following command in Lua,



local info1 = torch.load("object.t7")


I receive the following error:




/home/hasan/build/torch/install/bin/luajit:
...an/build/torch/install/share/lua/5.1/threads/threads.lua:315:
...an/build/torch/install/share/lua/5.1/threads/threads.lua:183:
[thread 4 callback]
...e/hasan/build/torch/install/share/lua/5.1/torch/File.lua:375:
unknown object stack traceback: [C]: in function 'error'
...e/hasan/build/torch/install/share/lua/5.1/torch/File.lua:375: in
function 'readObject'
...e/hasan/build/torch/install/share/lua/5.1/torch/File.lua:409: in
function 'load'
/home/hasan/GAN/icml2016/data/donkey_folder_txt_coco.lua:112: in
function
[C]: in function 'xpcall'
...an/build/torch/install/share/lua/5.1/threads/threads.lua:234: in
function 'callback'
...asan/build/torch/install/share/lua/5.1/threads/queue.lua:65: in
function
<...asan/build/torch/install/share/lua/5.1/threads/queue.lua:41> [C]:
in function 'pcall'
...asan/build/torch/install/share/lua/5.1/threads/queue.lua:40: in
function 'dojob' [string " local Queue = require
'threads.queue'..."]:15: in main chunk




I need to run a torch training in Lua, with preprocessed data through Pytorch.



Is there any way to save ".t7" file via pytorch, and open it through Lua?



Thanks,







python lua pytorch torch






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 8:41

























asked Nov 8 at 8:32









yusuf

1,13711245




1,13711245








  • 1




    I'm not familia with Lua. But I guess the problem here is that PyTorch doesn't has it's own implementation for saving and loading the files. If you take a look at the source of torch.save you see that it's just one line relying on pythons pickle module (`cPickle for Python2). So you probably need to look for a way opening pickled files in Lua. Alternatively you could just try another way of saving and loading without pickle.
    – blue-phoenox
    Nov 8 at 9:10






  • 1




    I think did not point out the main problem really well: pickle is just an other python module. So Lua Torch has probably a completely different implementation for saving files and loading files, not based on pickle.
    – blue-phoenox
    Nov 8 at 12:16














  • 1




    I'm not familia with Lua. But I guess the problem here is that PyTorch doesn't has it's own implementation for saving and loading the files. If you take a look at the source of torch.save you see that it's just one line relying on pythons pickle module (`cPickle for Python2). So you probably need to look for a way opening pickled files in Lua. Alternatively you could just try another way of saving and loading without pickle.
    – blue-phoenox
    Nov 8 at 9:10






  • 1




    I think did not point out the main problem really well: pickle is just an other python module. So Lua Torch has probably a completely different implementation for saving files and loading files, not based on pickle.
    – blue-phoenox
    Nov 8 at 12:16








1




1




I'm not familia with Lua. But I guess the problem here is that PyTorch doesn't has it's own implementation for saving and loading the files. If you take a look at the source of torch.save you see that it's just one line relying on pythons pickle module (`cPickle for Python2). So you probably need to look for a way opening pickled files in Lua. Alternatively you could just try another way of saving and loading without pickle.
– blue-phoenox
Nov 8 at 9:10




I'm not familia with Lua. But I guess the problem here is that PyTorch doesn't has it's own implementation for saving and loading the files. If you take a look at the source of torch.save you see that it's just one line relying on pythons pickle module (`cPickle for Python2). So you probably need to look for a way opening pickled files in Lua. Alternatively you could just try another way of saving and loading without pickle.
– blue-phoenox
Nov 8 at 9:10




1




1




I think did not point out the main problem really well: pickle is just an other python module. So Lua Torch has probably a completely different implementation for saving files and loading files, not based on pickle.
– blue-phoenox
Nov 8 at 12:16




I think did not point out the main problem really well: pickle is just an other python module. So Lua Torch has probably a completely different implementation for saving files and loading files, not based on pickle.
– blue-phoenox
Nov 8 at 12:16

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203986%2fcreating-t7-torch-file-in-python%23new-answer', 'question_page');
}
);

Post as a guest





































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203986%2fcreating-t7-torch-file-in-python%23new-answer', 'question_page');
}
);

Post as a guest




















































































Popular posts from this blog

Schultheiß

Liste der Kulturdenkmale in Wilsdruff

Android Play Services Check