Closed LiXm1002 closed 4 years ago
Are you using torch 0.3.1? We use these dependencies.
Thanks for you reply, I think I got where the problem is, when training the network , I use DataDataParallel to train on multiple GPUs, so when prune the network, also needmodel = torch.nn.DataParallel(resnet(depth=args.depth, dataset=args.dataset)))
. Then it could prune the preresnet.
Thanks for sharing! I have trained a preresnet-164 use
python main.py -sr --s 0.00001 --dataset cifar10 --arch resnet --depth 164
, and I want to prune the model withpython resprune.py --dataset cifar10 --depth 164 --percent 0.4 --model [My model path] --save [My path]
, But it has some errors and I don't know how to solve. `Test set: Accuracy: 9262/10000 (92.6%)Cfg: [10, 15, 16, 24, 15, 16, 7, 9, 11, 17, 15, 15, 23, 15, 15, 8, 12, 15, 19, 15, 16, 20, 15, 15, 13, 12, 16, 21, 15, 16, 14, 15, 15, 18, 13, 16, 17, 12, 15, 13, 13, 15, 1, 4, 7, 9, 12, 16, 18, 12, 15, 25, 15, 16, 35, 32, 32, 38, 31, 32, 47, 32, 32, 44, 31, 32, 51, 30, 32, 43, 31, 32, 38, 31, 32, 43, 32, 32, 54, 32, 32, 70, 32, 32, 51, 32, 32, 52, 32, 32, 51, 31, 32, 52, 32, 32, 52, 30, 32, 57, 32, 32, 51, 30, 32, 61, 31, 32, 125, 64, 64, 59, 60, 64, 68, 60, 64, 66, 63, 64, 78, 62, 64, 89, 64, 64, 106, 63, 64, 119, 64, 64, 123, 64, 64, 149, 64, 64, 135, 64, 64, 144, 64, 63, 127, 64, 63, 139, 64, 63, 144, 64, 64, 135, 64, 64, 141, 63, 64, 141, 64, 63, 85] Traceback (most recent call last): File "resprune.py", line 181, in
m1.weight.data = m0.weight.data.clone()
File "/home/ubuntu/anaconda3/envs/YOLACT/lib/python3.6/site-packages/torch/nn/modules/module.py", line 585, in getattr
type(self).name, name))
AttributeError: 'Sequential' object has no attribute 'weight'`
Can someone give me some suggestions? Thanks very much!