Skip to content

fix: set PackedSeqParams.total_tokens for mamba seq packing#2529

Merged
terrykong merged 3 commits into
mainfrom
yifu/fix_mamba_seqpack
May 21, 2026
Merged

fix: set PackedSeqParams.total_tokens for mamba seq packing#2529
terrykong merged 3 commits into
mainfrom
yifu/fix_mamba_seqpack

Conversation

@yfw

@yfw yfw commented May 19, 2026

Copy link
Copy Markdown
Contributor

What does this PR do ?

Without total_tokens, PackedSeqParams.__post_init__ skips building seq_idx, so Mamba's SSM state never resets between packed samples. This results in high logprob errors.

Issues

List issues that this PR closes (syntax):

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Additional Information

Screenshot 2026-05-19 at 9 26 44 AM

@yfw
yfw requested review from a team as code owners May 19, 2026 09:20
@copy-pr-bot

copy-pr-bot Bot commented May 19, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yfw yfw added the CI:L1 Run doctests, unit tests, and functional tests label May 19, 2026
@yfw

yfw commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a81a6b7

@yfw

yfw commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a2e8aec

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

@yfw does this address the logprob regression?

@yfw

yfw commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@yfw does this address the logprob regression?

Yes, added a wandb screenshot in the description showing before and after this patch.

terrykong
terrykong previously approved these changes May 20, 2026
@terrykong terrykong added CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) and removed CI:L1 Run doctests, unit tests, and functional tests labels May 20, 2026
@terrykong

Copy link
Copy Markdown
Collaborator

@yfw approved, can you resolve the sphinx build, prob unrelated to PR, but easier to just solve in this one

@sebawastaken

Copy link
Copy Markdown

awesome to see the fix being pushed so fast, that bug kinda ruined my weekend :D

yfw added 2 commits May 21, 2026 13:08
Without total_tokens, PackedSeqParams.__post_init__ skips building
seq_idx, so Mamba's SSM state never resets between packed samples.
This results in high logprob errors.

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
@yfw
yfw force-pushed the yifu/fix_mamba_seqpack branch from a2e8aec to 7519be8 Compare May 21, 2026 20:17
@yfw

yfw commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 7519be8

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
@yfw

yfw commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 31e9e38

@terrykong
terrykong merged commit 247f2e3 into main May 21, 2026
37 checks passed
@terrykong
terrykong deleted the yifu/fix_mamba_seqpack branch May 21, 2026 22:02
yfw added a commit that referenced this pull request May 27, 2026
Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants