Skip to content

Conversation

@ZhiyuLi-Nvidia
Copy link
Contributor

@ZhiyuLi-Nvidia ZhiyuLi-Nvidia commented Jul 16, 2025

What does this PR do ?

fix: maintain fp32 mlp.router.expert_bias even with bf16 enabled

model.layers.x.mlp.gate.e_score_correction_bias dtype is changing between step 1 to the following steps, which make it impossible to cache para dtype with inconsistency issue:

f"ERROR: {key}: {shape} != {shape_ref}", where shape is about 1st step, while shape_ref is the 2nd step

('ERROR: model.layers.3.mlp.gate.e_score_correction_bias: torch.bfloat16 != torch.float32',)

Details

avoid serializing rebuild_cuda_tensor function
serializing funciton is costly in transfer cudaipc between workers. Got some performance improvement with the change.

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

  • ...

@ZhiyuLi-Nvidia ZhiyuLi-Nvidia force-pushed the zhiyul/yukih/prepare-refit-info branch from 061c3fc to 72ceb4f Compare July 16, 2025 02:43
@ZhiyuLi-Nvidia ZhiyuLi-Nvidia changed the title Zhiyul/yukih/prepare refit info fix: maintain fp32 mlp.router.expert_bias even with bf16 enabled Jul 16, 2025
@ZhiyuLi-Nvidia ZhiyuLi-Nvidia requested review from yfw and yuki-97 July 16, 2025 02:47
@yuki-97 yuki-97 force-pushed the yukih/prepare-refit-info branch from c685241 to f152f61 Compare July 16, 2025 03:40
@yuki-97 yuki-97 changed the base branch from yukih/prepare-refit-info to main July 16, 2025 03:44
@yuki-97 yuki-97 force-pushed the zhiyul/yukih/prepare-refit-info branch from 72ceb4f to a6018ab Compare July 16, 2025 03:51
@yuki-97 yuki-97 changed the base branch from main to yukih/prepare-refit-info July 16, 2025 03:52
@yuki-97
Copy link
Contributor

yuki-97 commented Jul 16, 2025

Target to yukih/prepare-refit-info first for comparing the modification easily.
Will target to main after #638 merged.

yfw
yfw previously approved these changes Jul 16, 2025
Signed-off-by: Yuki Huang <[email protected]>
@yuki-97 yuki-97 force-pushed the zhiyul/yukih/prepare-refit-info branch from fd433d3 to ad1d3ba Compare July 16, 2025 12:50
Base automatically changed from yukih/prepare-refit-info to main July 16, 2025 21:50
@terrykong terrykong dismissed yfw’s stale review July 16, 2025 21:50

The base branch was changed.

@ZhiyuLi-Nvidia
Copy link
Contributor Author

Close thie PR since it is part of #686.

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