Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

--load-serialized will make model fail to prune #564

Open
Little0o0 opened this issue Mar 21, 2022 · 1 comment
Open

--load-serialized will make model fail to prune #564

Little0o0 opened this issue Mar 21, 2022 · 1 comment

Comments

@Little0o0
Copy link

Little0o0 commented Mar 21, 2022

I found model without DataParallel wrapping it will fail to prune. i.e. --load-serialized will disable pruning.

When I run

python compress_classifier.py -a=resnet20_cifar -p=50 ../../../data/cifar10/ -j=22 --epochs=1 --lr=0.001 --masks-sparsity --compress=../agp-pruning/resnet18.schedule_agp.yaml --load-serialized

The total sparsity will always be 0.00

Total sparsity: 0.00

But if I run the same command line without --load-serialized

python compress_classifier.py -a=resnet20_cifar -p=50 ../../../data/cifar10/ -j=22 --epochs=1 --lr=0.001 --masks-sparsity --compress=../agp-pruning/resnet18.schedule_agp.yaml

The total sparsity will be 1.53 after 1 epoch

Total sparsity: 1.53
@Little0o0
Copy link
Author

Little0o0 commented Mar 21, 2022

I found model = torch.nn.DataParallel(model, device_ids=device_ids) is necessary for pruning but I do not know the reason.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant