pytorch / pytorch/tutorials

how to calculate the macs after prune?

Open
#2,313 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
9.3k
Forks
4.4k
Avg merge
1d 21h
Merged PRs (30d)
4

Description

🚀 Descirbe the improvement or the new tutorial

I use torch.nn.utils.prune as prune to prune the model, then I use torchprofile.profile_macs() to calculate the macs of Pruned_model, but I find the macs will be increase before prune.remove() to make the pruning permanent. it is normal because additional calculate wil be weight * mask.
but after I use prune.remove() to make the pruning permanent, the macs calculated by torchprofile.profile_macs() still same as the model befor prune.
2023-05-08_17-01-34

Existing tutorials on this topic

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported comparison between torch.nn.utils.prune and torchprofile.profile_macs(), both before and after prune.remove(). Review the issue's pruning and MAC-counting steps, then document the correct way to calculate MACs for the pruned model and clarify what result should count as done.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
documentation, machine-learning
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.