Skip to content

Conversation

@Nekofish-L
Copy link
Contributor

@Nekofish-L Nekofish-L commented Sep 3, 2025

Summary by CodeRabbit

  • New Features
    • Added support for the SeedOss causal language model, now available for use in generation workflows.
    • Enables loading and running SeedOss via the standard auto-model interface.
    • Includes optimized attention, normalization, and MLP blocks for improved model behavior.
    • Supports configurable positional embeddings and tensor-parallel token embeddings.
    • Public API updated to expose SeedOssForCausalLM for easier integration in applications.

Description

This PR adds support for the seed-oss model inference in TensorRT-LLM pytorch backend.

Dependency

Related Issues

#7196

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

  • 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

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

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.

@Nekofish-L Nekofish-L requested a review from a team as a code owner September 3, 2025 06:31
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 3, 2025

📝 Walkthrough

Walkthrough

Adds a new Torch-based SeedOss causal language model implementation and exposes it publicly. Introduces attention, decoder layer, model, and causal LM wrapper classes, integrates positional embedding configuration, input validation for embeddings vs. IDs, and metadata handling. Updates package init to import and export SeedOssForCausalLM.

Changes

Cohort / File(s) Summary
Public API exposure
tensorrt_llm/_torch/models/__init__.py
Imports SeedOssForCausalLM from .modeling_seedoss and adds it to __all__; no other logic changed.
SeedOss model implementation
tensorrt_llm/_torch/models/modeling_seedoss.py
Adds SeedOssAttention, SeedOssDecoderLayer, SeedOssModel, and SeedOssForCausalLM with configuration-driven RoPE setup, RMSNorms, gated MLP, decoder stack construction, forward flow with input validation, optional hidden-state capture, and auto-model registration.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant LM as SeedOssForCausalLM
  participant M as SeedOssModel
  participant L as SeedOssDecoderLayer*
  participant A as SeedOssAttention
  participant P as GatedMLP

  U->>LM: generate()/forward(input_ids or inputs_embeds,<br/>attn_metadata, mrope_config?, spec_metadata?)
  LM->>M: forward(...)
  alt XOR input selection
    M->>M: compute inputs_embeds from input_ids
  else
    M->>M: use provided inputs_embeds
  end
  loop for each layer
    M->>L: forward(hidden_states, residual,<br/>position_ids, attn_metadata,<br/>mrope_config?, spec_metadata?)
    L->>A: self-attn(hidden_states, attn_metadata,<br/>rope params)
    A-->>L: attn_output
    L->>P: mlp(post-attn normalized states)
    P-->>L: mlp_output
    note over L: maybe_capture_hidden_states(...) if spec_metadata
    L-->>M: (hidden_states, residual)
  end
  M->>M: final RMSNorm
  M-->>LM: hidden_states
  LM-->>U: logits / outputs
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

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

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: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tensorrt_llm/_torch/models/__init__.py (1)

1-1: Add NVIDIA copyright header.

Per repo guidelines, prepend the current-year NVIDIA copyright header to all Python sources.

Add at the very top:

# Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
🧹 Nitpick comments (3)
tensorrt_llm/_torch/models/modeling_seedoss.py (3)

56-56: Fix init return annotation (must be None).

__init__ should not annotate a tuple return type.

Apply this diff:

-    ) -> Tuple[torch.Tensor, torch.Tensor]:
+    ) -> None:

79-88: Fix forward() return annotation to match actual return value.

Method returns (hidden_states, residual) but annotation says torch.Tensor.

Apply this diff:

-    ) -> torch.Tensor:
+    ) -> Tuple[torch.Tensor, torch.Tensor]:

153-156: Clarify the input validation and message.

Logic is fine, but the message doesn’t cover the “both None” case. Slightly clearer predicate + message.

Apply this diff:

-        if (input_ids is None) ^ (inputs_embeds is not None):
-            raise ValueError(
-                "You cannot specify both input_ids and inputs_embeds at the same time, and must specify either one"
-            )
+        if (input_ids is None) == (inputs_embeds is None):
+            raise ValueError("Specify exactly one of input_ids or inputs_embeds.")
📜 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 79d93f9 and 319849d.

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

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Filenames compiled into a target must be case-insensitively unique

Files:

  • tensorrt_llm/_torch/models/__init__.py
  • tensorrt_llm/_torch/models/modeling_seedoss.py
**/*.{h,hpp,hh,hxx,cc,cpp,cxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Use spaces, not tabs; indent 4 spaces

Files:

  • tensorrt_llm/_torch/models/__init__.py
  • tensorrt_llm/_torch/models/modeling_seedoss.py
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: Code must target Python 3.8+
Indent with 4 spaces; do not use tabs (Python)
Maintain module namespace on import: prefer from package.subpackage import foo; use foo.Symbol()
Python filenames use snake_case
Python class names use PascalCase
Python functions and methods use snake_case
Python local variables use snake_case; if starting with a number concept, prefix with k (e.g., k_99th_percentile)
Python global variables use G_ prefix with UPPER_SNAKE_CASE
Python constants use UPPER_SNAKE_CASE
Avoid shadowing variables from outer scopes
Initialize all externally visible class members in init
For public interfaces, prefer docstrings over comments; comments should be for in-function or file-local interfaces
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes and variables inline with docstrings immediately after assignment
Avoid reflection when a non-reflective approach suffices
Limit except clauses to specific exceptions where possible
When using try/except for duck-typing, keep try body minimal and move logic to else

Files:

  • tensorrt_llm/_torch/models/__init__.py
  • tensorrt_llm/_torch/models/modeling_seedoss.py
**/*.{cpp,cc,cxx,h,hpp,hh,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Prepend NVIDIA copyright header (current year) to all source files

Files:

  • tensorrt_llm/_torch/models/__init__.py
  • tensorrt_llm/_torch/models/modeling_seedoss.py
🧬 Code graph analysis (2)
tensorrt_llm/_torch/models/__init__.py (1)
tensorrt_llm/_torch/models/modeling_seedoss.py (1)
  • SeedOssForCausalLM (179-188)
tensorrt_llm/_torch/models/modeling_seedoss.py (7)
tensorrt_llm/_torch/attention_backend/interface.py (3)
  • AttentionMetadata (39-331)
  • PositionalEmbeddingParams (501-516)
  • RopeParams (345-497)
tensorrt_llm/_torch/modules/embedding.py (1)
  • Embedding (164-242)
tensorrt_llm/_torch/modules/gated_mlp.py (1)
  • GatedMLP (18-164)
tensorrt_llm/_torch/modules/linear.py (1)
  • TensorParallelMode (44-56)
tensorrt_llm/_torch/speculative/interface.py (1)
  • SpecMetadata (116-211)
tensorrt_llm/_torch/models/modeling_speculative.py (1)
  • SpecDecOneEngineForCausalLM (360-468)
tensorrt_llm/_torch/models/modeling_utils.py (1)
  • register_auto_model (595-601)

@svc-trtllm-gh-bot svc-trtllm-gh-bot added the Community want to contribute PRs initiated from Community label Sep 3, 2025
@karljang
Copy link
Collaborator

karljang commented Sep 4, 2025

@Nekofish-L , thank you for the contribution.
Before moving forward, could you please check this contribution guide: CONTRIBUTING.md#signing-your-work
In addition, you will want to add "[None][feat]" to pass some checks~ :)

@Nekofish-L Nekofish-L changed the title feat: add model seed-oss [None][feat] add model seed-oss Sep 5, 2025
@Nekofish-L Nekofish-L force-pushed the dev-seed-oss branch 3 times, most recently from 6e10d17 to cd3ef55 Compare September 5, 2025 02:36
@Nekofish-L
Copy link
Contributor Author

Hi @karljang , Thank you for the review!
I have signed the work and updated the commit message as suggested.

@karljang
Copy link
Collaborator

karljang commented Sep 5, 2025

@Nekofish-L ,
I don't know why but still the DCO check seems to fail. Could you try the instructions from here: DCO

@Nekofish-L
Copy link
Contributor Author

Hi @karljang ,
the DCO check has passed.

@Nekofish-L
Copy link
Contributor Author

Nekofish-L commented Sep 8, 2025

Batch Size Under Different token/s SLOs (H20-96G)

TensorRT-LLM(TP2-FP8) TensorRT-LLM(TP2-BF16) vLLM(TP2-BF16)
20 token/s BS: 128 BS: 80 BS: 64
10 token/s BS: 256 BS: 160 BS: 128

acc:

TensorRT-LLM(FP8) vLLM(TP2-BF16)
CMMLU samples 0.794 0.8015

@karljang
Copy link
Collaborator

karljang commented Sep 9, 2025

@Nekofish-L
Copy link
Contributor Author

Hi @karljang ,
I have successfully executed the scripts/release_check.py script locally, and all tests have passed.
image

@nv-guomingz
Copy link
Collaborator

@Wanli-Jiang ,this PR requires to upgrade transformers to 4.56. Could you please upgrade transformers in a separate PR ?

@Wanli-Jiang
Copy link
Collaborator

@Wanli-Jiang ,this PR requires to upgrade transformers to 4.56. Could you please upgrade transformers in a separate PR ?

#7523, some CI tests failed, need to fix them firstly. Let's wait for a while.

@Nekofish-L
Copy link
Contributor Author

Hi @Wanli-Jiang , could you please review this PR? Its dependency(#7523 ) has now been merged into the main branch.

Copy link
Collaborator

@Wanli-Jiang Wanli-Jiang left a comment

Choose a reason for hiding this comment

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

codes are neat and look good to me.

@nv-guomingz should we require the unittests for community contributed models?

@Wanli-Jiang
Copy link
Collaborator

@Nekofish-L can you rebase your commits on recent main branch? It is conflicted with ToT. thanks!

about the tests, other teammates will help.

@Nekofish-L
Copy link
Contributor Author

@Wanli-Jiang , I've rebased my branch onto the latest main and resolved the conflicts. It should be good to go now.
Also, thanks for the team's support.

@Wanli-Jiang
Copy link
Collaborator

/bot run

Copy link
Collaborator

@Wanli-Jiang Wanli-Jiang left a comment

Choose a reason for hiding this comment

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

thanks for the contribution

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19772 [ run ] triggered by Bot

@Wanli-Jiang Wanli-Jiang enabled auto-merge (squash) September 24, 2025 08:09
@tensorrt-cicd
Copy link
Collaborator

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

@Wanli-Jiang Wanli-Jiang merged commit cfbcf9b into NVIDIA:main Sep 24, 2025
5 checks passed
@Nekofish-L Nekofish-L deleted the dev-seed-oss branch October 14, 2025 07:53
@karljang karljang mentioned this pull request Nov 12, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community want to contribute PRs initiated from Community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants