[Core] Simplify MRV2 async output handling (#45442)
This commit is contained in:
@@ -396,9 +396,7 @@ class MultiprocExecutor(Executor):
|
||||
return responses[0] if output_rank is not None else responses
|
||||
|
||||
future = FutureWrapper(
|
||||
self.futures_queue,
|
||||
get_response=get_response,
|
||||
aggregate=aggregate,
|
||||
self.futures_queue, get_response=get_response, aggregate=aggregate
|
||||
)
|
||||
|
||||
return future if non_block else future.result()
|
||||
@@ -982,6 +980,9 @@ class WorkerProc:
|
||||
func = partial(cloudpickle.loads(method), self.worker)
|
||||
|
||||
output = func(*args, **kwargs)
|
||||
|
||||
if output_rank is None or self.rank == output_rank:
|
||||
self.handle_output(output)
|
||||
except Exception as e:
|
||||
# Notes have been introduced in python 3.11
|
||||
if hasattr(e, "add_note"):
|
||||
@@ -991,10 +992,6 @@ class WorkerProc:
|
||||
# string, only for logging purpose.
|
||||
if output_rank is None or self.rank == output_rank:
|
||||
self.handle_output(e)
|
||||
continue
|
||||
|
||||
if output_rank is None or self.rank == output_rank:
|
||||
self.handle_output(output)
|
||||
|
||||
@staticmethod
|
||||
def setup_proc_title_and_log_prefix(enable_ep: bool) -> None:
|
||||
|
||||
@@ -90,6 +90,8 @@ class UniProcExecutor(Executor):
|
||||
|
||||
if not non_block:
|
||||
result = run_method(self.driver_worker, method, args, kwargs)
|
||||
if isinstance(result, AsyncModelRunnerOutput):
|
||||
result = result.get_output()
|
||||
return result if single_value else [result]
|
||||
|
||||
try:
|
||||
|
||||
@@ -145,7 +145,6 @@ class GPUModelRunner(LoRAModelRunnerMixin):
|
||||
self.max_num_reqs = self.scheduler_config.max_num_seqs
|
||||
self.is_encoder_decoder = self.model_config.is_encoder_decoder
|
||||
|
||||
self.use_async_scheduling = self.scheduler_config.async_scheduling
|
||||
self.output_copy_stream = torch.cuda.Stream(self.device)
|
||||
|
||||
# Pipeline parallelism.
|
||||
@@ -1457,9 +1456,7 @@ class GPUModelRunner(LoRAModelRunnerMixin):
|
||||
kv_connector_output = self.kv_connector.post_forward(finished_req_ids)
|
||||
model_runner_output.kv_connector_output = kv_connector_output
|
||||
|
||||
if self.use_async_scheduling:
|
||||
return async_output
|
||||
return async_output.get_output()
|
||||
return async_output
|
||||
|
||||
def take_draft_token_ids(self) -> DraftTokenIds | None:
|
||||
return self.draft_tokens_handler.get_draft_tokens()
|
||||
@@ -1503,9 +1500,7 @@ class GPUModelRunner(LoRAModelRunnerMixin):
|
||||
)
|
||||
|
||||
self.postprocess_num_computed_tokens(input_batch)
|
||||
if self.use_async_scheduling:
|
||||
return async_output
|
||||
return async_output.get_output()
|
||||
return async_output
|
||||
|
||||
def postprocess_num_computed_tokens(self, input_batch: InputBatch) -> None:
|
||||
# Update the number of computed tokens.
|
||||
|
||||
Reference in New Issue
Block a user