[Rust Frontend][gRPC] Add RL lifecycle control (#51316)
Signed-off-by: Connor Carpenter <connorc@nvidia.com> Co-authored-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
co-authored by
Nick Hill
parent
3e3ceb1961
commit
f473870ecf
@@ -92,6 +92,9 @@ class EngineCoreReadyResponse:
|
||||
kv_cache_size_tokens: int | None = None
|
||||
kv_cache_max_concurrency: float | None = None
|
||||
kv_events_config: KVEventsConfig | None = None
|
||||
weight_transfer_backend: str | None = None
|
||||
enable_sleep_mode: bool = False
|
||||
supports_draft_weight_updates: bool = False
|
||||
|
||||
|
||||
class EngineCoreRequest(
|
||||
|
||||
@@ -1635,6 +1635,15 @@ class EngineCoreProc(EngineCore):
|
||||
max_num_batched_tokens=scheduler_config.max_num_batched_tokens,
|
||||
instance_id=self.vllm_config.instance_id,
|
||||
kv_events_config=self.scheduler.get_kv_event_publisher_config(),
|
||||
weight_transfer_backend=(
|
||||
self.vllm_config.weight_transfer_config.backend
|
||||
if self.vllm_config.weight_transfer_config is not None
|
||||
else None
|
||||
),
|
||||
enable_sleep_mode=self.vllm_config.model_config.enable_sleep_mode,
|
||||
supports_draft_weight_updates=(
|
||||
self.model_executor.supports_draft_weight_updates()
|
||||
),
|
||||
)
|
||||
|
||||
def process_input_sockets(
|
||||
|
||||
@@ -289,6 +289,12 @@ class Executor(ABC):
|
||||
output = self.collective_rpc("get_supported_tasks")
|
||||
return output[0]
|
||||
|
||||
def supports_draft_weight_updates(self) -> bool:
|
||||
worker_support: list[bool] = self.collective_rpc(
|
||||
"supports_draft_weight_updates"
|
||||
)
|
||||
return all(worker_support)
|
||||
|
||||
def add_lora(self, lora_request: LoRARequest) -> bool:
|
||||
assert lora_request.lora_int_id > 0, "lora_id must be greater than 0."
|
||||
return all(self.collective_rpc("add_lora", args=(lora_request,)))
|
||||
|
||||
@@ -869,6 +869,19 @@ class Worker(WorkerBase):
|
||||
def get_draft_model(self) -> nn.Module | None:
|
||||
return self.model_runner.get_draft_model()
|
||||
|
||||
def supports_draft_weight_updates(self) -> bool:
|
||||
engine = self.weight_transfer_engine
|
||||
speculative_config = self.speculative_config
|
||||
get_draft_model = getattr(self.model_runner, "get_draft_model", None)
|
||||
return (
|
||||
engine is not None
|
||||
and engine.supports_draft_weight_update
|
||||
and callable(get_draft_model)
|
||||
and get_draft_model() is not None
|
||||
and speculative_config is not None
|
||||
and speculative_config.draft_model_config is not None
|
||||
)
|
||||
|
||||
def _set_draft_weight_update_target(self) -> None:
|
||||
assert self.weight_transfer_engine is not None
|
||||
|
||||
|
||||
@@ -125,6 +125,10 @@ class WorkerBase:
|
||||
def get_model(self) -> nn.Module:
|
||||
raise NotImplementedError
|
||||
|
||||
def supports_draft_weight_updates(self) -> bool:
|
||||
"""Whether this worker can update its configured speculative model."""
|
||||
return False
|
||||
|
||||
def apply_model(self, fn: Callable[[nn.Module], _R]) -> _R:
|
||||
"""Apply a function on the model inside this worker."""
|
||||
return fn(self.get_model())
|
||||
|
||||
Reference in New Issue
Block a user