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

max_prune_rate in global pruning #448

Open
AvrahamRaviv opened this issue Dec 19, 2024 · 0 comments
Open

max_prune_rate in global pruning #448

AvrahamRaviv opened this issue Dec 19, 2024 · 0 comments

Comments

@AvrahamRaviv
Copy link

It seems that using global pruning isn't working together with max_prune_rate . I suggest adding the second condition in metapruner.py:

imp_argsort = torch.argsort(imp)
if len(_pruning_indices)>0 and self.round_to:
    n_pruned = len(_pruning_indices)
    current_channels = get_channel_fn(module)
    n_pruned = self._round_to(n_pruned, current_channels, self.round_to)
    _pruning_indices = imp_argsort[:n_pruned]
# ----->
if len(_pruning_indices) > 0 and self.max_pruning_ratio < 1:
    n_pruned = len(_pruning_indices)
    while n_pruned / get_channel_fn(module) > self.max_pruning_ratio:
        n_pruned = len(_pruning_indices) - 1
        _pruning_indices = imp_argsort[:n_pruned]
# <-----
pruning_indices.append(_pruning_indices)
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

No branches or pull requests

1 participant