Torch/Lua,如何将训练有素的神经网络模型保存到文件中? [英] Torch / Lua, how to save a trained neural network model to file?

查看:137
本文介绍了Torch/Lua,如何将训练有素的神经网络模型保存到文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从事Torch/Lua项目,在其中实施了人工神经网络模型. 一切正常,但是现在我想通过以下方式修改我的代码.由于我的输入数据集非常大,因此我想将其划分为N = 20个跨度.

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.

然后我只想在第一个数据集跨度上训练我的神经网络,然后并行测试其他N-1 = 19个跨度.

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.

要运行所有这些并行作业,我需要将神经网络模型详细信息保存到文件中,然后每19个作业加载一次.

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.

有没有办法正确地将人工神经网络模型写入"文件?

推荐答案

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

.

-- load the model
model = torch.load(filename)

这篇关于Torch/Lua,如何将训练有素的神经网络模型保存到文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆