Skip to content

Conversation

@ChenhanYu
Copy link
Collaborator

@ChenhanYu ChenhanYu commented Jan 14, 2026

What does this PR do?

Type of change: ? Bug fix

Overview:

Passing trust_remote_code all the way through during export and import. This is needed since DeepSeek will error out if trust_remote_code=True but Nemotron-H will error out if trust_remote_code=False

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

Summary by CodeRabbit

  • Bug Fixes
    • Updated default trust_remote_code parameter from True to False in GPT model export and import functionality.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: Chenhan Yu <chenhany@nvidia.com>
@ChenhanYu ChenhanYu requested a review from a team as a code owner January 14, 2026 02:14
@ChenhanYu ChenhanYu requested a review from Edwardf0t1 January 14, 2026 02:14
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 14, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The changes modify the GPTModelExporter class and two export/import functions in the unified export module to add and adjust the trust_remote_code parameter. The default value is changed from True to False in GPTModelExporter.__init__, and the parameter is added to both export_mcore_gpt_to_hf and import_mcore_gpt_from_hf functions with a default of False, then propagated to their respective exporter/importer constructors.

Changes

Cohort / File(s) Summary
Trust Remote Code Parameter Propagation
modelopt/torch/export/unified_export_megatron.py
Changed trust_remote_code default from True to False in GPTModelExporter.__init__. Added trust_remote_code: bool = False parameter to export_mcore_gpt_to_hf function and forwarded to exporter. Added trust_remote_code: bool = False parameter to import_mcore_gpt_from_hf function and forwarded to importer.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chg: passing through trust_remote_code' accurately describes the primary change: adding and propagating the trust_remote_code parameter through export and import functions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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


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

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

@ChenhanYu ChenhanYu requested review from kevalmorabia97 and meenchen and removed request for Edwardf0t1 January 14, 2026 02:15
@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.22%. Comparing base (18d9b1e) to head (4de7932).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #778   +/-   ##
=======================================
  Coverage   74.22%   74.22%           
=======================================
  Files         192      192           
  Lines       19027    19027           
=======================================
  Hits        14123    14123           
  Misses       4904     4904           

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

Signed-off-by: Chenhan Yu <chenhany@nvidia.com>
dtype=torch.bfloat16,
dequantize: bool = True,
trust_remote_code: bool = False,
trust_remote_code: bool = True,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we set default to True?

Copy link
Contributor

@meenchen meenchen Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the same question here. Is this an intended change?

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