[MRV2] Detatch weight-reload logic from MRV1 (#60937)
This commit is contained in:
@@ -16,7 +16,12 @@ import torch
|
||||
import torch.nn as nn
|
||||
|
||||
import vllm.envs as envs
|
||||
from vllm.config import CUDAGraphMode, VllmConfig, set_current_vllm_config
|
||||
from vllm.config import (
|
||||
CUDAGraphMode,
|
||||
VllmConfig,
|
||||
set_current_vllm_config,
|
||||
update_config,
|
||||
)
|
||||
from vllm.config.compilation import CompilationMode
|
||||
from vllm.config.profiler import validate_profile_prefix
|
||||
from vllm.device_allocator import get_mem_allocator_instance
|
||||
@@ -591,7 +596,21 @@ class Worker(WorkerBase):
|
||||
set_torch_threads_for_runtime()
|
||||
|
||||
def update_config(self, overrides: dict[str, Any]) -> None:
|
||||
self.model_runner.update_config(overrides)
|
||||
"""Apply config overrides to the worker, its model runner and the
|
||||
shared VllmConfig."""
|
||||
allowed_config_names = {"load_config", "model_config"}
|
||||
for config_name, config_overrides in overrides.items():
|
||||
if config_name not in allowed_config_names:
|
||||
allowed = ", ".join(sorted(allowed_config_names))
|
||||
raise ValueError(
|
||||
f"Config override '{config_name}' is not supported. "
|
||||
f"Supported configs: {allowed}"
|
||||
)
|
||||
config = getattr(self.vllm_config, config_name)
|
||||
new_config = update_config(config, config_overrides)
|
||||
setattr(self.vllm_config, config_name, new_config)
|
||||
setattr(self.model_runner, config_name, new_config)
|
||||
setattr(self, config_name, new_config)
|
||||
|
||||
def reload_weights(self, *args, **kwargs) -> None:
|
||||
with set_current_vllm_config(self.vllm_config):
|
||||
|
||||
Reference in New Issue
Block a user