Skip to content
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

Clean up batch data structures: Introducing ModelWorkerBatch #1544

Merged
merged 17 commits into from
Sep 30, 2024
Merged

Conversation

merrymercy
Copy link
Contributor

The following is the flow of data structures for a batch:

ScheduleBatch -> ModelWorkerBatch -> ForwardBatch

  • ScheduleBatch is managed by scheduler.py::Scheduler.
    It contains high-level scheduling data. Most of the data is on the CPU.
  • ModelWorkerBatch is managed by tp_worker.py::TpModelWorker.
  • ForwardBatch is managed by model_runner.py::ModelRunner.
    It contains low-level tensor data. Most of the data consists of GPU tensors.

@merrymercy merrymercy changed the title Introduce ModelWorkerBatch Clean up batch data structures: Introducing ModelWorkerBatch Sep 30, 2024
@merrymercy merrymercy merged commit 63ba2f8 into main Sep 30, 2024
11 checks passed
@merrymercy merrymercy deleted the mem-pool branch September 30, 2024 13:41
@merrymercy
Copy link
Contributor Author

This PR introduces some perf regression. I will send a patch soon.

@hnyls2002 hnyls2002 mentioned this pull request Sep 30, 2024
3 tasks
image_inputs = [r.image_inputs for r in self.reqs]

lora_paths = [req.lora_path for req in self.reqs]
self.sampling_info.regex_fsm_states = [req.regex_fsm_state for req in self.reqs]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

possible overhead

if value is not None: # logit_bias can be None
setattr(self, item, value[new_indices])

self.regex_fsms = [self.regex_fsms[i] for i in new_indices]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

potential overhead

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.

1 participant