[Core] Remove the legacy Ray compiled-graph executor (#61712)
Signed-off-by: Woosuk Kwon <woosuk@inferact.ai> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
bfdbfa1632
commit
e57bb4ace7
@@ -1,79 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
import numpy as np
|
||||
|
||||
from vllm.distributed.aux_output_connector.connector import (
|
||||
AuxRequestOutput,
|
||||
)
|
||||
from vllm.v1.executor.ray_utils import detach_zero_copy_from_model_runner_output
|
||||
from vllm.v1.outputs import (
|
||||
LogprobsLists,
|
||||
LogprobsTensors,
|
||||
ModelRunnerOutput,
|
||||
)
|
||||
|
||||
|
||||
def _make_readonly(arr: np.ndarray) -> np.ndarray:
|
||||
arr.setflags(write=False)
|
||||
return arr
|
||||
|
||||
|
||||
def test_detach_zero_copy_from_model_runner_output_copies_only_numpy_views():
|
||||
cu_num_generated_tokens = [0, 2]
|
||||
prompt_logprobs = LogprobsTensors.empty_cpu(1, 2)
|
||||
output = ModelRunnerOutput(
|
||||
req_ids=["req-0"],
|
||||
req_id_to_index={"req-0": 0},
|
||||
logprobs=LogprobsLists(
|
||||
logprob_token_ids=_make_readonly(
|
||||
np.array([[1, 2], [3, 4]], dtype=np.int32)
|
||||
),
|
||||
logprobs=_make_readonly(
|
||||
np.array([[0.1, 0.2], [0.3, 0.4]], dtype=np.float32)
|
||||
),
|
||||
sampled_token_ranks=_make_readonly(np.array([1, 2], dtype=np.int32)),
|
||||
cu_num_generated_tokens=cu_num_generated_tokens,
|
||||
),
|
||||
prompt_logprobs_dict={"req-0": prompt_logprobs},
|
||||
)
|
||||
|
||||
original_logprobs = output.logprobs
|
||||
assert original_logprobs is not None
|
||||
|
||||
detach_zero_copy_from_model_runner_output(output)
|
||||
|
||||
detached_logprobs = output.logprobs
|
||||
assert detached_logprobs is not None
|
||||
assert detached_logprobs is not original_logprobs
|
||||
assert (
|
||||
detached_logprobs.logprob_token_ids is not original_logprobs.logprob_token_ids
|
||||
)
|
||||
assert detached_logprobs.logprobs is not original_logprobs.logprobs
|
||||
assert (
|
||||
detached_logprobs.sampled_token_ranks
|
||||
is not original_logprobs.sampled_token_ranks
|
||||
)
|
||||
assert detached_logprobs.logprob_token_ids.flags.writeable
|
||||
assert detached_logprobs.logprobs.flags.writeable
|
||||
assert detached_logprobs.sampled_token_ranks.flags.writeable
|
||||
assert detached_logprobs.cu_num_generated_tokens is cu_num_generated_tokens
|
||||
assert output.prompt_logprobs_dict["req-0"] is prompt_logprobs
|
||||
|
||||
|
||||
def test_detach_zero_copy_aux_output_without_logprobs():
|
||||
rows = _make_readonly(np.arange(12, dtype=np.uint8).reshape(2, 3, 2))
|
||||
output = ModelRunnerOutput(
|
||||
req_ids=["req-0"],
|
||||
req_id_to_index={"req-0": 0},
|
||||
aux_output_connector_output={"req-0": AuxRequestOutput(0, rows)},
|
||||
)
|
||||
|
||||
detach_zero_copy_from_model_runner_output(output)
|
||||
|
||||
aux_output = output.aux_output_connector_output
|
||||
assert aux_output is not None
|
||||
detached = aux_output["req-0"].rows
|
||||
assert detached is not rows
|
||||
assert detached.flags.writeable
|
||||
np.testing.assert_array_equal(detached, rows)
|
||||
Reference in New Issue
Block a user