-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
模型参数文件为何这么大? #56
Comments
第一个问题,你要区分train_logs和参数有什么不同,没错,我写的模型参数量应该是MB量级的,如果单纯存参数的话其实只有MB大小,但是,为了方便导入导出的操作,各个深度学习框架都提供了直接保存计算图的接口(当然也有保存参数的接口),这里我使用的是tensorflow保存计算图的接口,计算图中包括了模型训练到当前状态的很多参数以外的状态信息,所以,比较大是很正常的。第二个问题,有关于过拟合,模型是否过拟合与train_logs大小和存储的数据多少没有任何关系,甚至可以说与参数量也不是完全线性的关系,目前我们的模型还没有观察到明显的过拟合现象 |
我们重新精简了一下云盘的文件。因为有两个cnn model,fine model有440M,coarse model有380M,这个是正常的大小,你可以看一下 带你检查一下fine model的参数储存大小。
这样你得到了一个 import ast
from six.moves import reduce
def main(filename):
f = open(filename, 'r')
storage = 0
for i, line in enumerate(f):
if len(line) <= 1: continue
l = ast.literal_eval(line.split()[-1])
if len(l) == 0:
storage += 1 * 4
else:
storage += reduce(lambda x,y: x*y, l) * 4
print(storage)
if __name__ == "__main__":
filename = 'params.txt'
main(filename) 然后运行 这个是 |
@RICHARD-AN @Prinsphield 感谢解答, 谢谢你们的工作 |
厉害 学习了 |
然后我看了一下
train log
竟然有1.22G, 而训练数据data.tar
是239M. 虽然我对机器学习还没入门, 但按目前所了解的, 模型比训练数据大那么多总是不正常的. 模型其实就是几个权重矩阵, 再大应该也大不到这种程度. 真大到这种程度, 就那点训练数据也拟合不了吧The text was updated successfully, but these errors were encountered: