DeepCompression-caffe icon indicating copy to clipboard operation
DeepCompression-caffe copied to clipboard

snapshot crasp

Open jjkke88 opened this issue 8 years ago • 22 comments

when snapshot start, it crash.

I0721 11:04:23.275313 17167 solver.cpp:244]     Train net output #0: acc = 0.428571
I0721 11:04:23.275321 17167 solver.cpp:244]     Train net output #1: loss = 1.88784 (* 1 = 1.88784 loss)
I0721 11:04:23.275328 17167 sgd_solver.cpp:106] Iteration 9, lr = 0.001
I0721 11:04:23.275475 17167 solver.cpp:454] Snapshotting to binary proto file dataset/lenet_iter_10.caffemodel```

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

jjkke88 avatar Jul 21 '17 03:07 jjkke88

我也拉了博主的代码,跑了下,没有遇到你这个问题,不过跑出来后,发现caffemodel和以前一样的大,不知道是不是哪里操作的不对,你最后有弄出来没有?

daimagou avatar Jul 24 '17 01:07 daimagou

@jjkke88 保存时发生crash应该跟代码无关,可以检查一下是不是磁盘空间不够等问题

may0324 avatar Jul 25 '17 14:07 may0324

@daimagou 直接用caffe跑出来的模型依然是原始大小,因为模型依然是.caffemodel类型,虽然大部分权值为0且共享,但每个权值依然以32float型存储,故后续只需将非零权值及其下标以及聚类中心存储下来即可,这部分可参考作者论文,写的很详细。

may0324 avatar Jul 25 '17 14:07 may0324

any suggestions on how to store the non zero weights and cluster center?

pgadosey avatar Aug 14 '17 03:08 pgadosey

@may0324 根据你们的信息,model大小没变,但是预测速度有没有加快?

guozhongluo avatar Aug 16 '17 07:08 guozhongluo

@pgadosey pruning , predict can be speed up?

guozhongluo avatar Aug 16 '17 07:08 guozhongluo

为什么ComputeBlobMask()没有被调用?

xiaohu2015 avatar Aug 21 '17 12:08 xiaohu2015

@xiaohu2015 你读取的是.h5模型,要读取caffemodel格式模型,才会调用ComputeBlobMask()

guozhongluo avatar Aug 24 '17 06:08 guozhongluo

我说的是在LayerSetUp方法内要对这个函数进行调用吧

xiaohu2015 avatar Aug 24 '17 08:08 xiaohu2015

@xiaohu2015 deep compression 需要读入已训练好的模型做压缩,在LayerSetUp函数中,每层仅仅做了内存分配但未读入已训模型,因此此时的模型参数是随机初始化的,需要在CopyTrainedLayersFrom函数中调用ComputeBlobMask函数

may0324 avatar Aug 28 '17 03:08 may0324

@pgadosey i will show my code later for reference

may0324 avatar Aug 28 '17 03:08 may0324

@guozhongluo 实测在PC端提速效果不明显,因为大量权值为0 采用矩阵加速库影响不会很大,移动端有一定的提升

may0324 avatar Aug 28 '17 03:08 may0324

@may0324 本次只是做了权值减枝,剪完后 模型大小木有变化. 那运行时内存应该也不会发生变化,预测速度呢,有木有变化

suke27 avatar Sep 04 '17 07:09 suke27

@suke27 pc端由于采用了矩阵加速库,所以提速不明显,移动端稍有提升

may0324 avatar Sep 11 '17 10:09 may0324

@may0324 @daimagou @guozhongluo 在读取caffemodel参数时(前提是make matcaffe 已成功,且成功读取其它模型参数)使用MATLAB读取剪枝聚类后的caffemodel,出现如下错误 image

然后又用Python读取,也发生错误,程序与错误如下 image

image 希望能得到你们的帮助,非常感谢~

jiaqun123 avatar Oct 31 '17 07:10 jiaqun123

@pgadosey @may0324 hi,can you share the code that how to store the non zero weights and cluster center for reference? thanks very much

jiaqun123 avatar Nov 05 '17 13:11 jiaqun123

@jiaqun123 unforyunately, i never got around it. I found this repository that implemenets the quantization part of this paper but for inference purposes you have to dequantize your weights in order to use them. https://github.com/yuanyuanli85/CaffeModelCompression . Kindly let me know if you are able to store them in another way

pgadosey avatar Nov 06 '17 03:11 pgadosey

@pgadosey thanks, I found this repository that implemenets the storage of sparse matrix. https://github.com/ZhouYuSong/caffe-pruned . You can learn from it.

jiaqun123 avatar Nov 08 '17 11:11 jiaqun123

image hi,I run the python script,why the final accuracy is 0.0974?

MrLinNing avatar Jan 16 '18 12:01 MrLinNing

怎么查看压缩效果呢,,压完文件大小还是1.7M呀?

xingruan avatar Mar 24 '18 11:03 xingruan

@may0324 我感觉这种方式只能减少在硬盘或者flash上的的存储大小啊,在实际运行时,0还是要恢复到内存中,而且即使加了一个mask,也需要一条判断语句,感觉效果应该不明显啊。有没有人能解释解释。

xi-mao avatar Apr 16 '18 13:04 xi-mao

@jiaqun123 问一下 ,作者这个代码你是怎么编译运行的啊,还没用过caff,谢谢!

xi-mao avatar Apr 16 '18 13:04 xi-mao