Use cuda event wait and synchronization instead of busy waiting (#2089)
This commit is contained in:
@@ -142,12 +142,12 @@ class TpModelWorker:
|
||||
def forward_batch_generation(
|
||||
self,
|
||||
model_worker_batch: ModelWorkerBatch,
|
||||
launch_event: Optional[threading.Event] = None,
|
||||
launch_done: Optional[threading.Event] = None,
|
||||
):
|
||||
forward_batch = ForwardBatch.init_new(model_worker_batch, self.model_runner)
|
||||
logits_output = self.model_runner.forward(forward_batch)
|
||||
if launch_event:
|
||||
launch_event.set()
|
||||
if launch_done:
|
||||
launch_done.set()
|
||||
next_token_ids = self.model_runner.sample(logits_output, model_worker_batch)
|
||||
return logits_output, next_token_ids
|
||||
|
||||
|
||||
Reference in New Issue
Block a user