Skip to content

[https://nvbugs/5996024][fix] Enforce trust_remote_code flag - #13527

Merged
yibinl-nvidia merged 7 commits into
NVIDIA:mainfrom
yibinl-nvidia:fix/5996024-trust-flag-propagation
May 29, 2026
Merged

[https://nvbugs/5996024][fix] Enforce trust_remote_code flag#13527
yibinl-nvidia merged 7 commits into
NVIDIA:mainfrom
yibinl-nvidia:fix/5996024-trust-flag-propagation

Conversation

@yibinl-nvidia

@yibinl-nvidia yibinl-nvidia commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Improvements
    • Model loading now respects the trust_remote_code configuration setting, giving users greater control over security when loading models and tokenizers that may require remote code execution.

Review Change Stack

Description

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

@yibinl-nvidia yibinl-nvidia self-assigned this Apr 27, 2026
@yibinl-nvidia yibinl-nvidia changed the title [https://nvbugs/1234567][fix] Enforce trust_remote_code flag [https://nvbugs/5996024][fix] Enforce trust_remote_code flag Apr 27, 2026
@yibinl-nvidia
yibinl-nvidia force-pushed the fix/5996024-trust-flag-propagation branch 2 times, most recently from 33a7d24 to 0039d36 Compare May 22, 2026 02:27
@yibinl-nvidia
yibinl-nvidia marked this pull request as ready for review May 22, 2026 02:41
@yibinl-nvidia
yibinl-nvidia requested review from a team as code owners May 22, 2026 02:41
@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c40e39d0-2b5d-47e6-aa80-18dd138a780a

📥 Commits

Reviewing files that changed from the base of the PR and between eb6ee93 and 0039d36.

📒 Files selected for processing (5)
  • tensorrt_llm/_torch/pyexecutor/model_engine.py
  • tensorrt_llm/_torch/pyexecutor/model_loader.py
  • tensorrt_llm/inputs/registry.py
  • tensorrt_llm/llmapi/llm.py
  • tensorrt_llm/llmapi/mm_encoder.py

📝 Walkthrough

Walkthrough

This PR threads a trust_remote_code parameter through input processor initialization and model loading, replacing hardcoded True values with the user-supplied argument from LLM args in five files.

Changes

Trust Remote Code Parameter Threading

Layer / File(s) Summary
Input processor parameter and implementation
tensorrt_llm/inputs/registry.py
create_input_processor() signature adds trust_remote_code: bool = True parameter; function body passes it to ModelConfig.from_pretrained() and the registered processor constructor instead of hardcoding trust_remote_code=True.
Model loader respects args parameter
tensorrt_llm/_torch/pyexecutor/model_loader.py
load_config_and_apply_defaults() and _load_and_validate_config() now use llm_args.trust_remote_code instead of constant True when loading checkpoint and validation configs.
Call sites updated to pass trust_remote_code
tensorrt_llm/_torch/pyexecutor/model_engine.py, tensorrt_llm/llmapi/llm.py, tensorrt_llm/llmapi/mm_encoder.py
PyTorchModelEngine, BaseLLM, TrtLLM, TorchLLM, and MultimodalEncoder all updated to forward trust_remote_code from args when calling create_input_processor() and load_hf_model_config().

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is empty; all required template sections (Description, Test Coverage, PR Checklist details) lack substantive content beyond the template structure. Add a clear explanation of the issue being fixed, the solution implemented, and list the test cases that validate the changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly describes the main change: enforcing the trust_remote_code flag throughout the codebase by threading it through multiple components.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49822 [ run ] triggered by Bot. Commit: 0039d36 Link to invocation

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot kill

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49843 [ run ] triggered by Bot. Commit: fedf697 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49822 [ run ] completed with state ABORTED. Commit: 0039d36
/LLM/main/L0_MergeRequest_PR pipeline #39407 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot kill

@yibinl-nvidia
yibinl-nvidia force-pushed the fix/5996024-trust-flag-propagation branch from fedf697 to 3aa04fd Compare May 22, 2026 06:37
@yibinl-nvidia
yibinl-nvidia requested a review from a team as a code owner May 22, 2026 06:37
@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49869 [ kill ] triggered by Bot. Commit: 3aa04fd Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49843 [ run ] completed with state ABORTED. Commit: fedf697

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49869 [ kill ] completed with state SUCCESS. Commit: 3aa04fd
Successfully killed previous jobs for commit 3aa04fd

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49870 [ run ] triggered by Bot. Commit: 3aa04fd Link to invocation

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot kill

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49917 [ kill ] triggered by Bot. Commit: 3aa04fd Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49870 [ run ] completed with state ABORTED. Commit: 3aa04fd

Link to invocation

Signed-off-by: Yibin Li <109242046+yibinl-nvidia@users.noreply.github.com>
@yibinl-nvidia
yibinl-nvidia force-pushed the fix/5996024-trust-flag-propagation branch from 7215c52 to 1ca0adc Compare May 28, 2026 22:32
@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot kill

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50901 [ kill ] triggered by Bot. Commit: 1ca0adc Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50864 [ run ] completed with state ABORTED. Commit: 7215c52

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50901 [ kill ] completed with state SUCCESS. Commit: 1ca0adc
Successfully killed previous jobs for commit 1ca0adc

Link to invocation

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50904 [ run ] triggered by Bot. Commit: 1ca0adc Link to invocation

@achartier achartier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

tensorrt_llm/inputs/utils.py at line 846 still has a hardcoded trust_remote_code=True

Comment thread tests/integration/defs/accuracy/test_llm_api_pytorch_multimodal.py Outdated
Comment thread tensorrt_llm/llmapi/llm.py Outdated
Comment thread tensorrt_llm/llmapi/llm.py Outdated
Signed-off-by: Yibin Li <109242046+yibinl-nvidia@users.noreply.github.com>
@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot kill

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50930 [ kill ] triggered by Bot. Commit: 2c9f8db Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50904 [ run ] completed with state ABORTED. Commit: 1ca0adc

Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50930 [ kill ] completed with state SUCCESS. Commit: 2c9f8db
Successfully killed previous jobs for commit 2c9f8db

Link to invocation

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50934 [ run ] triggered by Bot. Commit: 2c9f8db Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #50934 [ run ] completed with state SUCCESS. Commit: 2c9f8db
/LLM/main/L0_MergeRequest_PR pipeline #40394 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51040 [ run ] triggered by Bot. Commit: 2c9f8db Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51040 [ run ] completed with state SUCCESS. Commit: 2c9f8db
/LLM/main/L0_MergeRequest_PR pipeline #40487 completed with status: 'SUCCESS'

CI Report

Link to invocation

Signed-off-by: Yibin Li <109242046+yibinl-nvidia@users.noreply.github.com>
@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot help

@github-actions

Copy link
Copy Markdown

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

Details

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental) --high-priority]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Supports wildcard * for pattern matching (e.g., "*PerfSanity*" matches all stages containing PerfSanity). Examples: "A10-PyTorch-1, xxx", "PerfSanity". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Supports wildcard * for pattern matching. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx", --extra-stage "Post-Merge".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

--high-priority (OPTIONAL) : Run the pipeline with high priority. This option is restricted to authorized users only and will route the job to a high-priority queue.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@yibinl-nvidia

Copy link
Copy Markdown
Collaborator Author

/bot reuse-pipeline

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51086 [ reuse-pipeline ] triggered by Bot. Commit: 84ac83e Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #51086 [ reuse-pipeline ] completed with state SUCCESS. Commit: 84ac83e
Reusing PR_Github #51040 for commit 84ac83e

Link to invocation

@yibinl-nvidia
yibinl-nvidia merged commit 91371dd into NVIDIA:main May 29, 2026
7 checks passed
@yibinl-nvidia
yibinl-nvidia deleted the fix/5996024-trust-flag-propagation branch May 29, 2026 19:28
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.

6 participants