Unverified Commit dfe166e3 authored by chicm-ms's avatar chicm-ms Committed by GitHub
Browse files

Fix pruner issues (#2265)

parent 0fd8466b
...@@ -27,7 +27,7 @@ prune_config = { ...@@ -27,7 +27,7 @@ prune_config = {
'model_name': 'naive', 'model_name': 'naive',
'pruner_class': AGP_Pruner, 'pruner_class': AGP_Pruner,
'config_list': [{ 'config_list': [{
'initial_sparsity': 0, 'initial_sparsity': 0.,
'final_sparsity': 0.8, 'final_sparsity': 0.8,
'start_epoch': 0, 'start_epoch': 0,
'end_epoch': 10, 'end_epoch': 10,
......
...@@ -212,7 +212,7 @@ class AGP_Pruner(Pruner): ...@@ -212,7 +212,7 @@ class AGP_Pruner(Pruner):
if epoch > 0: if epoch > 0:
self.now_epoch = epoch self.now_epoch = epoch
for wrapper in self.get_modules_wrapper(): for wrapper in self.get_modules_wrapper():
wrapper.if_calculated.copy_(torch.tensor(0)) # pylint: disable=not-callable wrapper.if_calculated = False
class SlimPruner(Pruner): class SlimPruner(Pruner):
""" """
......
...@@ -19,6 +19,15 @@ do ...@@ -19,6 +19,15 @@ do
python3 model_prune_torch.py --pruner_name $name --pretrain_epochs 1 --prune_epochs 1 python3 model_prune_torch.py --pruner_name $name --pretrain_epochs 1 --prune_epochs 1
done done
echo 'testing level pruner pruning'
python3 model_prune_torch.py --pruner_name level --pretrain_epochs 1 --prune_epochs 1
echo 'testing agp pruning'
python3 model_prune_torch.py --pruner_name agp --pretrain_epochs 1 --prune_epochs 2
echo 'testing mean_activation pruning'
python3 model_prune_torch.py --pruner_name mean_activation --pretrain_epochs 1 --prune_epochs 1
#echo "testing lottery ticket pruning..." #echo "testing lottery ticket pruning..."
#python3 lottery_torch_mnist_fc.py #python3 lottery_torch_mnist_fc.py
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment