-
Notifications
You must be signed in to change notification settings - Fork 751
[Others]Prefill-Decode Batch Invariant in glm #8000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bukejiyu
wants to merge
1
commit into
PaddlePaddle:develop
Choose a base branch
from
bukejiyu:pd_batch_invariant
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -255,7 +255,23 @@ def graph_optimize_and_warm_up_model(self) -> None: | |
| # than subsequent requests, causing occasional first-run divergence. | ||
| if envs.FD_DETERMINISTIC_MODE: | ||
| set_random_seed(self.fd_config.model_config.seed) | ||
| self.model_runner.share_inputs.reset_share_inputs() | ||
| # self.model_runner.share_inputs.reset_share_inputs() | ||
| if hasattr(self.model_runner.share_inputs, "reset_share_inputs"): | ||
| self.model_runner.share_inputs.reset_share_inputs() | ||
| elif isinstance(self.model_runner.share_inputs, dict): | ||
| # 创建一个临时的 InputBatch 来借用它的逻辑 | ||
| from fastdeploy.worker.input_batch import InputBatch | ||
|
|
||
| temp_batch = InputBatch.__new__(InputBatch) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 建议 另外,被注释掉的原始调用 建议简化为: if envs.FD_DETERMINISTIC_MODE:
set_random_seed(self.fd_config.model_config.seed)
if hasattr(self.model_runner.share_inputs, 'reset_share_inputs'):
self.model_runner.share_inputs.reset_share_inputs() |
||
| temp_batch.__dict__.update(self.model_runner.share_inputs) # 把字典内容注入 | ||
| temp_batch.model_config = self.fd_config.model_config | ||
| temp_batch.scheduler_config = self.fd_config.scheduler_config | ||
| temp_batch.cache_config = self.fd_config.cache_config | ||
| temp_batch.reset_share_inputs() | ||
| # 把结果写回字典 | ||
| self.model_runner.share_inputs.update( | ||
| {k: v for k, v in temp_batch.__dict__.items() if k in self.model_runner.share_inputs} | ||
| ) | ||
|
|
||
| def check_health(self) -> bool: | ||
| """ """ | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 建议 形状判断
weight.shape[0] == K用于推断 weight 是否已经是 [K, N],但当矩阵为方阵(K == N)时无法区分两种布局,会静默地走weight is already [K, N]分支,可能产生错误的矩阵乘法。建议直接使用
weight_transposed参数进行判断(该参数已由调用方传入),或与 Paddle flagFLAGS_use_accuracy_compatible_kernel对齐:若
weight_transposed语义在不同 Paddle 版本下不一致,至少应在方阵场景下加断言或警告。