Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Torch / Lua, how to save a trained neural network model to file?

I working on a Torch / Lua project, in which I implemented an artificial neural network model. Everything works, but now I'd like to modify my code in the following way. Since my input dataset are very large, I'd like to divide it in N=20 spans.

Then I want to train my neural network only on the 1st dataset span and then test on the other N-1=19 spans in parallel.

To run all these parallel jobs, I need to save up my neural network model details to a file, and then load it for every 19 jobs.

Is there any way in torch to correctly "write" an artificial neural network model to file?

like image 724
DavideChicco.it Avatar asked Oct 22 '15 18:10

DavideChicco.it


1 Answers

-- save the model
torch.save(filename, model)

.

-- load the model
model = torch.load(filename)
like image 161
smhx Avatar answered Oct 18 '22 08:10

smhx