torch-model-compression icon indicating copy to clipboard operation
torch-model-compression copied to clipboard

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

Results 15 torch-model-compression issues
Sort by recently updated
recently updated
newest added

问题如题,想请教下为什么最后一层使用conv而不是linear,改成conv会导致最终输出维度不定 ``` self.linear=nn.Conv2d(self.base_channel*4*block.expansion,self.base_channel*4*block.expansion,1,1,0) # self.linear = nn.Linear(self.base_channel*4*block.expansion, num_classes) ```

``` File "examples/torchpruner/prune_by_class_bisenetv2.py", line 39, in model, context = torchpruner.set_cut(model, result) File "site-packages/torchpruner-0.0.1-py3.8.egg/torchpruner/model_pruner.py", line 71, in set_cut File "site-packages/torchpruner-0.0.1-py3.8.egg/torchpruner/module_pruner/pruners.py", line 188, in set_cut File "site-packages/torchpruner-0.0.1-py3.8.egg/torchpruner/module_pruner/pruners.py", line 60, in set_cut File...

运行到第六个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'),...

Hi, does there any speed test on common models such as resnet50, YOLOv4 before and after compression? if there is a table indicates that would be very nice

谢谢您的工作! BiSeNet是否已经支持?

我在`prune_by_class.py`程序中测试了一下剪枝前后模型预测结果的差别,发现结果差距很大,这种现象正常吗,还是说我的理解有问题。代码如下 ```python import sys sys.path.append("..") import torch import torchpruner import torchvision import numpy as np # 以下代码示例了对每一个BN层去除其weight系数绝对值前20%小的层 inputs_sample = torch.ones(1, 3, 224, 224).to('cpu') # 加载模型 model = torchvision.models.vgg11_bn() result_source =...

使用resrep对yolov5l, yolov5m剪枝,网络无法训练,一开始就就不收敛直接变nan。

question

你好,我在使用resnet18为主干网的retinanet时,自己使用稀疏训练后的模型剪枝会报错,我的做法是: 1. 首先将训练好的模型计算bn的阈值得到每个bn层应该要剪枝的索引,并保存到一个dict里。 2. 然后循环1中的dict使用torchprunner去剪枝,会遇到前面的某些层如果剪了过多通道,后面层再剪时会出现索引越界。 3. 下面是我的部分代码。 ``` python import torchpruner # 创建ONNXGraph对象,绑定需要被剪枝的模型 self.model.eval() graph = torchpruner.ONNXGraph(self.model.cpu()) ##build ONNX静态图结构,需要指定输入的张量 graph.build_graph(inputs=(torch.zeros(1, 3, 640, 640),)) for i, (k, v) in enumerate(mask_dict_for_pruner.items()): #...

question