Skip to content

Conversation

kevalmorabia97
Copy link
Collaborator

@kevalmorabia97 kevalmorabia97 commented Sep 5, 2025

What does this PR do?

Type of change: minor code improvement

Overview: Remove nemo imports for pruning supported model list as that can cause circular imports. Instead we can have checks on nemo/m-lm example before invoking pruning api.

Usage

N/A

Testing

N/A

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
  • Did you write any new necessary tests?: No
  • Did you add or update any necessary documentation?: No
  • Did you update Changelog?: No

Additional Information

Summary by CodeRabbit

  • Refactor

    • Streamlined pruning search by using direct model configuration access.
    • Removed runtime model-type checks to reduce overhead and potential compatibility barriers.
    • Applied automatic derivation of attention KV channels when not specified.
  • Chores

    • Cleaned up unused utilities related to model-type discovery.

@kevalmorabia97 kevalmorabia97 requested a review from a team as a code owner September 5, 2025 16:20
Copy link

coderabbitai bot commented Sep 5, 2025

Walkthrough

The change removes a helper for model-type validation, eliminates runtime checks against a supported-models set, and updates run_search to use self.model.config directly. It computes and sets kv_channels on the config when absent and applies SUPPORTED_HPARAMS from export_config to the model configuration.

Changes

Cohort / File(s) Summary of Changes
Pruning plugin: config handling and validation removal
modelopt/torch/prune/plugins/mcore_minitron.py
Deleted get_supported_models() and associated dynamic imports. Removed model-type validation in run_search. Switched to direct use of self.model.config. Preserved kv_channels derivation (hidden_size // num_attention_heads) when missing and wrote back to config. Applied SUPPORTED_HPARAMS from export_config to config. No public API signature changes.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant U as Caller
    participant S as MCoreMinitronSearcher
    participant M as Model
    participant C as model.config
    participant E as export_config

    U->>S: run_search(model, export_config)
    S->>M: access model
    S->>C: model.config (retrieve)
    note over S,C: Direct config access (changed)
    S->>C: if kv_channels is None → set hidden_size//num_attention_heads
    S->>C: apply SUPPORTED_HPARAMS from export_config
    S-->>U: return search result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I nibbled old checks, let them fade away,
Now configs speak plainly, guiding the way.
Kv seeds split true, heads count the sky—
Hop, tweak, apply; no imports to try.
In fields of tensors, I prune with delight,
Ears up, code clean, sprinting light. 🥕🐇


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2b52759 and 2656566.

📒 Files selected for processing (1)
  • modelopt/torch/prune/plugins/mcore_minitron.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: linux
  • GitHub Check: wait-checks / wait
  • GitHub Check: build-docs
  • GitHub Check: code-quality
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kmorabia/remove-pruning-support-models

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Sep 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.95%. Comparing base (76fb12d) to head (2656566).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #290   +/-   ##
=======================================
  Coverage   73.95%   73.95%           
=======================================
  Files         172      172           
  Lines       17405    17405           
=======================================
  Hits        12871    12871           
  Misses       4534     4534           

☔ 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.

@kevalmorabia97 kevalmorabia97 merged commit 1cf78b2 into main Sep 5, 2025
20 checks passed
@kevalmorabia97 kevalmorabia97 deleted the kmorabia/remove-pruning-support-models branch September 5, 2025 17:27
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.

2 participants