Skip to content

[BugFix] support real batch_size - #3109

Merged
Jiang-Jia-Jun merged 23 commits into
PaddlePaddle:developfrom
lizexu123:xx_sen_len
Aug 5, 2025
Merged

Jiang-Jia-Jun merged 23 commits into
PaddlePaddle:developfrom
lizexu123:xx_sen_len

Conversation

@lizexu123

Copy link
Copy Markdown
Collaborator

Fix the inference logic to use num_running_requests instead of max_num_seqs; the latter brought clear gains on smaller models.

@paddle-bot

paddle-bot Bot commented Jul 31, 2025

Copy link
Copy Markdown

Thanks for your contribution!

@lizexu123 lizexu123 closed this Jul 31, 2025
@lizexu123 lizexu123 reopened this Jul 31, 2025
@iosmers

iosmers commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator

LGTM

Comment thread fastdeploy/worker/xpu_worker.py Outdated
) -> Optional[ModelRunnerOutput]:
""" """
output = self.model_runner.execute_model(model_forward_batch)
if not is_dummy_run:

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.

为什么需要区分是否 is_dummy_run ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

这里写反了,已修改,因为xpu里面dummy_run用的execute_model,而num_running_requests不可能为空,而dummy_run这个传不进去,所以在这里做了判断,dummy_run的时候不做切分

self.model_inputs["block_tables"][idx : idx + 1, :block_num] = np.arange(
idx * block_num, (idx + 1) * block_num, 1
)
self.model_inputs["seq_lens_this_time"] = self.seq_lens_this_time_buffer

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.

没有slice吗

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

dummy的过程不需要

Comment thread fastdeploy/spec_decode/mtp.py Outdated
)

def insert_prefill_inputs(self, req_dicts: List[Request]):
def insert_prefill_inputs(self, req_dicts: List[Request], num_running_requests):

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.

输入类型声明下

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

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

LGTM

@Jiang-Jia-Jun
Jiang-Jia-Jun merged commit b01cfd6 into PaddlePaddle:develop Aug 5, 2025
9 of 13 checks passed
lizexu123 added a commit to lizexu123/FastDeploy that referenced this pull request Aug 5, 2025
* support real bsz

* fix

* fix xpu_model_runner.py,gpu_model_runner.py,gcu_model_runner.py,iluvatar_model_runner.py

* add event_loop_ep

* fix

* Add comments

* fix

* support mtp real_batch_size

* fix

* self.tmp_seq_lens_this_time->self.seq_lens_this_time_buffer

* fix

* fix VL real_seq_lens_this_time

* fix

* fix mtp

* fix

* fix mtp

* fix xpu

* fix
Jiang-Jia-Jun pushed a commit that referenced this pull request Aug 6, 2025
* support real bsz

* fix

* fix xpu_model_runner.py,gpu_model_runner.py,gcu_model_runner.py,iluvatar_model_runner.py

* add event_loop_ep

* fix

* Add comments

* fix

* support mtp real_batch_size

* fix

* self.tmp_seq_lens_this_time->self.seq_lens_this_time_buffer

* fix

* fix VL real_seq_lens_this_time

* fix

* fix mtp

* fix

* fix mtp

* fix xpu

* fix
iosmers added a commit that referenced this pull request Aug 8, 2025
xiaoguoguo626807 pushed a commit to xiaoguoguo626807/FastDeploy that referenced this pull request May 7, 2026
* support real bsz

* fix

* fix xpu_model_runner.py,gpu_model_runner.py,gcu_model_runner.py,iluvatar_model_runner.py

* add event_loop_ep

* fix

* Add comments

* fix

* support mtp real_batch_size

* fix

* self.tmp_seq_lens_this_time->self.seq_lens_this_time_buffer

* fix

* fix VL real_seq_lens_this_time

* fix

* fix mtp

* fix

* fix mtp

* fix xpu

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

6 participants