Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Add network trimming pruning algorithm and fix bias mask(testing) #1867

Merged
merged 20 commits into from
Dec 24, 2019

Conversation

tanglang96
Copy link
Contributor

@tanglang96 tanglang96 commented Dec 22, 2019

Add pruning algorithm based on the activation statistics(network trimming in the iteration plan, more detailed docs will be updated later); Fix bias mask in the pruning.

@tanglang96 tanglang96 changed the title Add network trimming pruning algorithm and fix bias mask Add network trimming pruning algorithm and fix bias mask(testing) Dec 22, 2019
docs/en_US/Compressor/ActivationRankFilterPruner.md Outdated Show resolved Hide resolved
docs/en_US/Compressor/Pruner.md Show resolved Hide resolved
docs/en_US/Compressor/Pruner.md Show resolved Hide resolved
docs/en_US/Compressor/Pruner.md Show resolved Hide resolved
print('# Epoch {} #'.format(epoch))
train(model, device, train_loader, optimizer_finetune)
top1 = test(model, device, test_loader)
if top1 > best_top1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to use a validate dataset here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking it should be a validation dataset, but this way is commonly used in other release code of papers, so I followed this way.

Copy link
Contributor

@xuehui1991 xuehui1991 Dec 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's wired that we test directly in test dataset. I think we could change it.

src/sdk/pynni/nni/compression/torch/builtin_pruners.py Outdated Show resolved Hide resolved
@scarlett2018 scarlett2018 mentioned this pull request Dec 23, 2019
44 tasks
@QuanluZhang
Copy link
Contributor

look great. please resolve comments :)

assert all(mask1['weight'].numpy() == np.array([0., 0., 0., 1., 1.]))
assert all(mask2['weight'].numpy() == np.array([0., 0., 0., 1., 1.]))
assert all(mask1['bias'].numpy() == np.array([0., 0., 0., 1., 1.]))
assert all(mask2['bias'].numpy() == np.array([0., 0., 0., 1., 1.]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to add UT for new activation pruners?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I'm working on it

@QuanluZhang QuanluZhang merged commit b0c0eb7 into microsoft:master Dec 24, 2019
@leckie-chn leckie-chn mentioned this pull request Dec 25, 2019
19 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants