THU-MIG / torch-model-compression

针对pytorch模型的自动化模型结构分析和修改工具集,包含自动分析模型结构的模型压缩算法库

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

examples中prune.py运行报错

chihoz opened this issue · comments

commented

运行到第六个epoch时报错如下:
Traceback (most recent call last):
File "D:\Pycharm\PyCharm 2021.2.3\plugins\python\helpers\pydev\pydevd.py", line 1483, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:\Pycharm\PyCharm 2021.2.3\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "E:/python project/torch-model-compression-main/torch-model-compression-main/examples/torchslim/pytorch-cifar/prune.py", line 94, in
solver.run()
File "D:\Anoconda\lib\site-packages\torchpruner-0.1.0-py3.8.egg\torchslim\slim_solver.py", line 354, in run
File "D:\Anoconda\lib\site-packages\torchpruner-0.1.0-py3.8.egg\torchslim\slim_solver.py", line 224, in run_hook
File "D:\Anoconda\lib\site-packages\torchpruner-0.1.0-py3.8.egg\torchslim\pruning\resrep.py", line 297, in after_iteration_hook
File "D:\Anoconda\lib\site-packages\torchpruner-0.1.0-py3.8.egg\torchpruner\graph.py", line 622, in build_graph
File "D:\Anoconda\lib\site-packages\torchpruner-0.1.0-py3.8.egg\torchpruner\operator\operator.py", line 186, in fill_shape
"""
RuntimeError: Fail to predict the shape on operator name: 'self.bn1.BatchNormalization', type: 'BatchNormalization'
是什么原因呢?

我也遇到了这个问题,请问你解决了吗?

我是在window上运行报Fail to predict the shape on operator name: 'self.bn1.BatchNormalization', type: 'BatchNormalization'这个错误,在linux上运行正常。估计是安装包环境问题

我是在window上运行报Fail to predict the shape on operator name: 'self.bn1.BatchNormalization', type: 'BatchNormalization'这个错误,在linux上运行正常。估计是安装包环境问题

我在linux上同样也遇到了这个问题...

commented

我也遇到了这个问题,请问你解决了吗?

请问下您解决了吗

commented

我是在window上运行报Fail to predict the shape on operator name: 'self.bn1.BatchNormalization', type: 'BatchNormalization'这个错误,在linux上运行正常。估计是安装包环境问题

我在linux上同样也遇到了这个问题...

请问下您解决了吗这个问题,我在Linux系统上也遇到了相同的问题。

你们 pytorch 版本太新了,我在 torch==1.9.0+cu111 上测试正常,只是 torch==1.13.1+cu117 就不行了

测试发现是 pytorch 改了 BatchNormalization 的功能,某些时候会增加输出个数,从 1 个增加到 5 个。

Commit 3410752 强行忽略了后几个,应该能跑了。

commented

你们 pytorch 版本太新了,我在 torch==1.9.0+cu111 上测试正常,只是 torch==1.13.1+cu117 就不行了

测试发现是 pytorch 改了 BatchNormalization 的功能,某些时候会增加输出个数,从 1 个增加到 5 个。

Commit 3410752 强行忽略了后几个,应该能跑了。

好的,谢谢前辈,已经解决了,看到您都是凌晨解答,注意休息!