Skip to content

Conversation

@kaix-nv
Copy link
Contributor

@kaix-nv kaix-nv commented Nov 6, 2025

What does this PR do?

Type of change: ?

Overview: ?
Reorganizes the modelopt/torch/sparsity module to prepare for adding attention sparsity support. All existing weight sparsity functionality (source code and tests) is moved into a dedicated weight_sparsity subdirectory while maintaining full backward compatibility.

# These imports still work exactly as before
from modelopt.torch.sparsity import sparsify, magnitude_prune
from modelopt.torch.sparsity.mode import SparsityMode

Usage

# Add a code snippet demonstrating how to use this

Testing

Before your PR is "Ready for review"

  • Make sure you read and follow Contributor guidelines and your commits are signed.
  • Is this change backward compatible?: Yes/No
  • Did you write any new necessary tests?: Yes/No
  • Did you add or update any necessary documentation?: Yes/No
  • Did you update Changelog?: Yes/No

Additional Information

@kaix-nv kaix-nv requested a review from a team as a code owner November 6, 2025 02:26
@kaix-nv kaix-nv force-pushed the kaix/weight_sparsity_reorg branch from 6b9df2b to 93877cd Compare November 6, 2025 02:38
@kaix-nv kaix-nv changed the title Reorganize sparsity module to separate weight and attention sparsity [1/n] Reorganize sparsity module to separate weight and attention sparsity Nov 6, 2025
@kevalmorabia97
Copy link
Collaborator

Apart from GitHub CICD checks, can you also verify llm_sparsity example test is working fine? pytest tests/examples/llm_sparsity

@kaix-nv kaix-nv requested review from cjluo-nv and mxinO November 6, 2025 19:26
@kaix-nv
Copy link
Contributor Author

kaix-nv commented Nov 6, 2025

Apart from GitHub CICD checks, can you also verify llm_sparsity example test is working fine? pytest tests/examples/llm_sparsity

I've verified that all the tests have passed.

@kaix-nv kaix-nv force-pushed the kaix/weight_sparsity_reorg branch from 4afa07a to 4ab73ff Compare November 6, 2025 21:41
@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.53%. Comparing base (5adb9ba) to head (cdd34f7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #517   +/-   ##
=======================================
  Coverage   73.52%   73.53%           
=======================================
  Files         181      182    +1     
  Lines       18207    18211    +4     
=======================================
+ Hits        13387    13391    +4     
  Misses       4820     4820           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kaix-nv kaix-nv enabled auto-merge (squash) November 7, 2025 00:26
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.

4 participants