Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add snip_momentum structured pruning which supports higher sparse ratio #3300

Merged
merged 2 commits into from May 10, 2023

Conversation

ftian1
Copy link
Contributor

@ftian1 ftian1 commented Apr 19, 2023

This PR is used to contribute snip_momentum pruning algorithm in Intel Neural Compress to DeepSpeed compression like we proposed in RFC.

The snip_momentum algo implements the algorithm described in here.

We tested it on DeepSpeedExamples/compression/bert with a newly added script bash_script/pruning_sparse_snip_momentum.sh and get below results. The changes in examples is here

pattern sparsity ratio pruning method epochs acc & mm-acc
1x1   80% DeepSpeed L1     2   0.8113/0.822
1x1   80% Snip_momentum 2   0.8176/0.822
4x1   80% snip_momentum 10 0.8248/0.8305

cc @hshen14 @wenhuach21

@ftian1
Copy link
Contributor Author

ftian1 commented Apr 19, 2023

@microsoft-github-policy-service agree company="Intel"

@wenhuach21
Copy link

wenhuach21 commented Apr 19, 2023

Due to different algorithms may not share the same best hyperparameter, we have tried others. The main difference is we only use the second to last layer for distillation and change the lr.

pattern sparsity ratio pruning method epochs acc & mm-acc
4x1 80% Snip_momentum 2 0.8284/0.8388
4x1 80% Snip_momentum 6 0.8339/0.8418

@xiaoxiawu-microsoft
Copy link
Contributor

tested the accuracy and looks great.

@xiaoxiawu-microsoft
Copy link
Contributor

@ftian1, there is a formatting issue on the PR. The pre-commit needs to be run and the file changes committed to the branch. In particular, the following needs to be run on the repo:

pre-commit run --all-files

Contributing - DeepSpeed

auto-merge was automatically disabled May 9, 2023 07:12

Head branch was pushed to by a user without write access

@ftian1
Copy link
Contributor Author

ftian1 commented May 9, 2023

@xiaoxiawu-microsoft sorry for the late response due to PRC holiday and thanks for your review.

I have fixed the yapf scan issue. but in my local, the detection of destroyed symlinks always fail after merge master. not sure why it happens as everything looks good. so I push the code at first. Hope it will not waste pre-ci resources.

…ratio with minor accuracy loss

Signed-off-by: Tian, Feng <feng.tian@intel.com>
@ftian1
Copy link
Contributor Author

ftian1 commented May 10, 2023

@xiaoxiawu-microsoft Those pre-ci errors are not related with my changes, could you pls have a check?

@xiaoxiawu-microsoft xiaoxiawu-microsoft merged commit 6938c44 into microsoft:master May 10, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants