Skip to content

Conversation

@karljang
Copy link
Collaborator

@karljang karljang commented Aug 27, 2025

This PR fixes #7208.

Summary by CodeRabbit

  • Refactor

    • Medusa initialization updated to reliably select the correct variant-specific configuration based on the model type, preserving prior defaults and public interfaces.
  • Bug Fixes

    • Fixed configuration selection so missing or differently cased model type values no longer prevent the intended variant from being chosen, reducing initialization errors.

Description

Test Coverage

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)]

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. Examples: "A10-PyTorch-1, xxx". 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. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

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

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

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.

Signed-off-by: Kanghwan Jang <861393+karljang@users.noreply.github.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 27, 2025

📝 Walkthrough

Walkthrough

MedusaConfig selection logic was fixed: it now reads model_type from kwargs, lowercases it, and chooses QWenConfig when 'qwen' appears in model_type; otherwise it uses LLaMAConfig. Remaining initialization (e.g., setting num_medusa_heads) is unchanged.

Changes

Cohort / File(s) Change summary
Medusa config logic
tensorrt_llm/models/medusa/config.py
Import QWenConfig from ..qwen.config; replace attribute-check logic with reading model_type = str(kwargs.get('model_type','')).lower() and select QWenConfig if 'qwen' in model_type, else LLaMAConfig. Initialization afterwards unchanged.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Caller as User code
    participant Medusa as MedusaConfig.__init__
    participant QWen as QWenConfig
    participant LLaMA as LLaMAConfig

    Caller->>Medusa: MedusaConfig(**kwargs)
    Medusa->>Medusa: model_type = str(kwargs.get('model_type','')).lower()
    alt model_type contains "qwen"
        Medusa->>QWen: instantiate QWenConfig(**kwargs)
        QWen-->>Medusa: QWenConfig instance
    else
        Medusa->>LLaMA: instantiate LLaMAConfig(**kwargs)
        LLaMA-->>Medusa: LLaMAConfig instance
    end
    Medusa->>Medusa: set self.config and num_medusa_heads
    Medusa-->>Caller: MedusaConfig instance
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective (issue #) Addressed Explanation
Ensure MedusaConfig selects QWenConfig when model_type is "qwen" (#7208)
Make model_type check robust for dict kwargs and case-insensitive (#7208)

(Only objectives from the linked issue were assessed.)


📜 Recent review details

Configuration used: Path: .coderabbit.yaml

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 084a884 and fc92195.

📒 Files selected for processing (1)
  • tensorrt_llm/models/medusa/config.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tensorrt_llm/models/medusa/config.py
⏰ 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). (1)
  • GitHub Check: Pre-commit Check
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit 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:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit 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 @coderabbit help to get the list of available commands.

Other keywords and placeholders

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

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.

@karljang karljang requested a review from kaiyux August 27, 2025 23:05
@karljang karljang changed the title [#7208][fix]Fix config type of MedusaConfig [#7208][fix] Fix config type of MedusaConfig Aug 27, 2025
@karljang
Copy link
Collaborator Author

/bot run

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

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 8a619be and 3c02a94.

📒 Files selected for processing (1)
  • tensorrt_llm/models/medusa/config.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: Code must target Python 3.8+
Indent Python code with 4 spaces; do not use tabs
Preserve module namespaces when importing; import modules/packages and access members via the module (e.g., from package.subpackage import foo; foo.SomeClass())
Python file names should be snake_case
Python class names should be PascalCase
Python functions/methods and local variables should be snake_case; variables beginning with a number should be prefixed with k_ (e.g., k_99th_percentile)
Global variables should be UPPER_SNAKE_CASE prefixed with G_ (e.g., G_MY_GLOBAL); constants should be UPPER_SNAKE_CASE
Avoid shadowing variables from outer scopes; initialize all externally visible members in init
Prefer docstrings for interfaces used outside a file; comments should be reserved for in-function or file-local interfaces
Use Google-style docstrings for classes and functions; attributes and variables may be documented inline with trailing string literals
Avoid reflection when simpler, explicit code suffices (e.g., avoid dict(**locals()) patterns)
In try/except, catch the narrowest exceptions possible
For duck-typing patterns, keep the try body minimal and move logic to else to avoid masking unrelated failures

Files:

  • tensorrt_llm/models/medusa/config.py
**/*.{c,cc,cpp,cxx,h,hh,hpp,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Prepend the NVIDIA copyright header (current year) to all source files (.cpp, .h, .cu, .py, etc.)

Files:

  • tensorrt_llm/models/medusa/config.py
🧬 Code graph analysis (1)
tensorrt_llm/models/medusa/config.py (2)
tensorrt_llm/models/qwen/config.py (1)
  • QWenConfig (23-210)
tensorrt_llm/models/llama/config.py (1)
  • LLaMAConfig (27-278)
🪛 Ruff (0.12.2)
tensorrt_llm/models/medusa/config.py

34-34: Undefined name QWenConfig

(F821)

⏰ 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). (1)
  • GitHub Check: Pre-commit Check

@tensorrt-cicd
Copy link
Collaborator

PR_Github #16754 [ run ] triggered by Bot

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tensorrt_llm/models/medusa/config.py (1)

36-38: Correct config dispatch; prefer startswith and clearer name (minor)

Logic now correctly derives from kwargs and avoids KeyError. For precision and readability:

  • Use startswith to avoid accidental substring matches.
  • Name the local to reflect it holds a class.

Apply:

-        model_type = str(kwargs.get('model_type', '')).lower()
-        generic_medusa_config = QWenConfig if 'qwen' in model_type else LLaMAConfig
-        self.config = generic_medusa_config(**kwargs)
+        model_type = str(kwargs.get('model_type', '')).lower()
+        backing_config_cls = QWenConfig if model_type.startswith('qwen') else LLaMAConfig
+        self.config = backing_config_cls(**kwargs)

If useful, I can add a regression test asserting:

  • MedusaConfig(model_type="qwen"), "QWEN", "qwen2_moe" → QWenConfig
  • MedusaConfig(model_type="llama") or missing → LLaMAConfig
📜 Review details

Configuration used: Path: .coderabbit.yaml

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 3c02a94 and 81c8bef.

📒 Files selected for processing (1)
  • tensorrt_llm/models/medusa/config.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: Code must target Python 3.8+
Indent Python code with 4 spaces; do not use tabs
Preserve module namespaces when importing; import modules/packages and access members via the module (e.g., from package.subpackage import foo; foo.SomeClass())
Python file names should be snake_case
Python class names should be PascalCase
Python functions/methods and local variables should be snake_case; variables beginning with a number should be prefixed with k_ (e.g., k_99th_percentile)
Global variables should be UPPER_SNAKE_CASE prefixed with G_ (e.g., G_MY_GLOBAL); constants should be UPPER_SNAKE_CASE
Avoid shadowing variables from outer scopes; initialize all externally visible members in init
Prefer docstrings for interfaces used outside a file; comments should be reserved for in-function or file-local interfaces
Use Google-style docstrings for classes and functions; attributes and variables may be documented inline with trailing string literals
Avoid reflection when simpler, explicit code suffices (e.g., avoid dict(**locals()) patterns)
In try/except, catch the narrowest exceptions possible
For duck-typing patterns, keep the try body minimal and move logic to else to avoid masking unrelated failures

Files:

  • tensorrt_llm/models/medusa/config.py
**/*.{c,cc,cpp,cxx,h,hh,hpp,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Prepend the NVIDIA copyright header (current year) to all source files (.cpp, .h, .cu, .py, etc.)

Files:

  • tensorrt_llm/models/medusa/config.py
🧬 Code graph analysis (1)
tensorrt_llm/models/medusa/config.py (2)
tensorrt_llm/models/qwen/config.py (1)
  • QWenConfig (23-210)
tensorrt_llm/models/llama/config.py (1)
  • LLaMAConfig (27-278)
⏰ 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). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (1)
tensorrt_llm/models/medusa/config.py (1)

22-22: Import fix unblocks QWen selection

Good add. Resolves the undefined name and enables the correct config dispatch.

Signed-off-by: Kanghwan Jang <861393+karljang@users.noreply.github.com>
Signed-off-by: Kanghwan Jang <861393+karljang@users.noreply.github.com>
@tensorrt-cicd
Copy link
Collaborator

PR_Github #16754 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #12574 completed with status: 'FAILURE'

@karljang
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #16902 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #16902 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #12698 completed with status: 'FAILURE'

@singularity-123
Copy link

Subject: Follow-up on PR #7320 for MedusaConfig Bug Fix

Hi @karljang,

I hope you’re doing well! I noticed that the PR (#7320) you opened for the MedusaConfig bug fix didn't succeed, as per the CI/CD logs.

It seems there is a failing check (blossom-ci) in the workflow, and I wanted to bring this to your attention in case it's something that can be addressed. Here's the detailed status of the CI/CD checks from the recent PR run:

1 failing check: blossom-ci

4 successful checks

Would you be able to take another look when you have a moment?

Thanks again for your attention to this, and I really appreciate your help in resolving the issue!

Best regards,
@singularity-123.

@karljang
Copy link
Collaborator Author

No worries~ I was looking into it, but need some time~ :)

@karljang
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #17035 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #17035 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #12797 completed with status: 'FAILURE'

@singularity-123
Copy link

Hi @karljang — following up on #7320.
blossom-ci is still red, and the failing stage is GB200-PyTorch-1 with the error “Stage run failed without result.” This looks more like missing/failed result generation or a timeout rather than an assertion failure; it could also be that GB200 resources are unavailable/not present.

Could you please check the job logs and the result artifact path?

If GB200 resources are temporarily unavailable, would you consider making this stage non-blocking or conditionally skipping it when resources are missing to avoid blocking the merge (and if blossom-ci is marked as Required, adjusting the configuration accordingly so the check doesn’t go red)? Thanks!

@karljang
Copy link
Collaborator Author

karljang commented Sep 2, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #17378 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #17378 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #13062 completed with status: 'FAILURE'

@karljang
Copy link
Collaborator Author

karljang commented Sep 3, 2025

/bot run

@karljang karljang enabled auto-merge (squash) September 3, 2025 00:26
@tensorrt-cicd
Copy link
Collaborator

PR_Github #17426 [ run ] triggered by Bot

@karljang
Copy link
Collaborator Author

karljang commented Sep 3, 2025

@kaiyux , could you review this PR?
I believe this is what you intended in your PR #2562

@tensorrt-cicd
Copy link
Collaborator

PR_Github #17426 [ run ] completed with state FAILURE
/LLM/main/L0_MergeRequest_PR pipeline #13097 completed with status: 'FAILURE'

@karljang
Copy link
Collaborator Author

karljang commented Sep 3, 2025

Just an update. There are some failed tests in the Jenkins, and I need more time to figure it out. :)

@karljang
Copy link
Collaborator Author

karljang commented Sep 3, 2025

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #17573 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #17573 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #13214 completed with status: 'SUCCESS'

@singularity-123
Copy link

Just an update. There are some failed tests in the Jenkins, and I need more time to figure it out. :)

Got it, I’ll keep following up on the progress. Thanks for your hard work! @karljang

@singularity-123
Copy link

I noticed that all the checks have passed successfully, and now we’re just waiting for the reviewer’s approval. Many thanks to everyone for your hard work and support! @karljang @kaiyux

@karljang karljang merged commit 758c22f into NVIDIA:main Sep 10, 2025
5 checks passed
Wong4j pushed a commit to Wong4j/TensorRT-LLM that referenced this pull request Sep 20, 2025
Signed-off-by: Kanghwan Jang <861393+karljang@users.noreply.github.com>
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.

[Bug]: Issue with MedusaConfig always using LLaMAConfig instead of QWenConfig

4 participants