Skip to content

code clean up#1110

Merged
danielkorzekwa merged 1 commit intofeature/puzzletronfrom
dkorzekwa/anymodel_remove_trust_remote_code
Mar 24, 2026
Merged

code clean up#1110
danielkorzekwa merged 1 commit intofeature/puzzletronfrom
dkorzekwa/anymodel_remove_trust_remote_code

Conversation

@danielkorzekwa
Copy link
Contributor

@danielkorzekwa danielkorzekwa commented Mar 24, 2026

What does this PR do?

Remove hardcoded trust_remote_code=true

Summary by CodeRabbit

Release Notes

  • Documentation

    • Clarified documentation for parameter counting in model layer calculations.
  • Bug Fixes

    • Remote code execution is now disabled by default in model configuration loading. Explicitly enable trust_remote_code when using custom modeling code.

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
@danielkorzekwa danielkorzekwa requested a review from a team as a code owner March 24, 2026 13:21
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c0cc0e48-5db9-4a97-964a-43b5268233c0

📥 Commits

Reviewing files that changed from the base of the PR and between 928036e and 44afe30.

📒 Files selected for processing (2)
  • modelopt/torch/puzzletron/subblock_stats/calc_subblock_params_and_memory.py
  • modelopt/torch/puzzletron/tools/checkpoint_utils_hf.py

📝 Walkthrough

Walkthrough

Two files modified to improve documentation and security defaults. The first updates docstrings and comments in subblock parameter calculation logic without changing function behavior. The second changes the trust_remote_code parameter default from True to False in model initialization for enhanced security.

Changes

Cohort / File(s) Summary
Documentation & Comments Update
modelopt/torch/puzzletron/subblock_stats/calc_subblock_params_and_memory.py
Simplified calculate_subblock_params docstring and refined inline comments explaining the initialization strategy and failure mode handling, with no functional code changes.
Security Default Parameter Change
modelopt/torch/puzzletron/tools/checkpoint_utils_hf.py
Changed trust_remote_code default parameter from True to False in init_model_from_config() and updated docstring to document the new secure-by-default behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10–15 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'code clean up' is vague and generic, using non-descriptive terminology that doesn't convey the specific nature of the changes (removing hardcoded trust_remote_code default and updating documentation). Consider a more specific title like 'Change trust_remote_code default from True to False in init_model_from_config' that clearly describes the main functional change.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Security Anti-Patterns ✅ Passed PR successfully removes hardcoded trust_remote_code=True, exposing parameter with secure False default. No security anti-patterns found in codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dkorzekwa/anymodel_remove_trust_remote_code

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.12%. Comparing base (928036e) to head (44afe30).
⚠️ Report is 1 commits behind head on feature/puzzletron.

Additional details and impacted files
@@                  Coverage Diff                   @@
##           feature/puzzletron    #1110      +/-   ##
======================================================
+ Coverage               72.10%   72.12%   +0.02%     
======================================================
  Files                     209      209              
  Lines                   23628    23628              
======================================================
+ Hits                    17036    17042       +6     
+ Misses                   6592     6586       -6     

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

@danielkorzekwa danielkorzekwa merged commit e508b76 into feature/puzzletron Mar 24, 2026
28 checks passed
@danielkorzekwa danielkorzekwa deleted the dkorzekwa/anymodel_remove_trust_remote_code branch March 24, 2026 15:01
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