[Core] Expose HWR payload validation in diffusion startup
Signed-off-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
1 parent
039808e0d9
commit
d989aa6fe2
11 files changed
+158
-1
No files matched your search
@@ -100,7 +100,9 @@ def normalize_omni_diffusion_kwargs(kwargs: Mapping[str, Any]) -> dict[str, Any]
|
||||
return normalized
|
||||
|
||||
|
||||
def validate_host_weight_runtime_options(*, mode: object, root: object) -> None:
|
||||
def validate_host_weight_runtime_options(
|
||||
*, mode: object, root: object, validation: object = "manifest_and_metadata"
|
||||
) -> None:
|
||||
"""Validate HWR policy without touching the configured storage domain.
|
||||
|
||||
Filesystem locality and store construction belong to the eligible loader
|
||||
@@ -109,6 +111,8 @@ def validate_host_weight_runtime_options(*, mode: object, root: object) -> None:
|
||||
"""
|
||||
if mode not in {"disabled", "preferred", "required"}:
|
||||
raise ValueError("host_weight_runtime_mode must be disabled, preferred, or required")
|
||||
if validation not in ("manifest_and_metadata", "full_checksum"):
|
||||
raise ValueError("host_weight_runtime_validation must be manifest_and_metadata or full_checksum")
|
||||
if mode != "disabled" and (not isinstance(root, str) or not root.strip()):
|
||||
raise ValueError("enabled Host Weight Runtime requires host_weight_runtime_root")
|
||||
|
||||
@@ -831,6 +835,7 @@ class OmniDiffusionConfig:
|
||||
# existing loader/storage path.
|
||||
host_weight_runtime_mode: str = "disabled"
|
||||
host_weight_runtime_root: str | None = None
|
||||
host_weight_runtime_validation: str = "manifest_and_metadata"
|
||||
# Optional per-worker ceiling for registering final-layout HWR mappings.
|
||||
# Zero adds no ceiling; pin_cpu_memory controls whether registration is tried.
|
||||
dlo_host_registration_limit_gib: float = 0.0
|
||||
@@ -1241,6 +1246,7 @@ class OmniDiffusionConfig:
|
||||
validate_host_weight_runtime_options(
|
||||
mode=self.host_weight_runtime_mode,
|
||||
root=self.host_weight_runtime_root,
|
||||
validation=self.host_weight_runtime_validation,
|
||||
)
|
||||
self.dlo_host_registration_limit_gib = validate_dlo_host_registration_options(
|
||||
limit_gib=self.dlo_host_registration_limit_gib,
|
||||
|
||||
@@ -26,6 +26,7 @@ from vllm_omni.diffusion.model_loader.host_weight_plan import HostWeightPlan, Te
|
||||
logger = init_logger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from vllm_omni.diffusion.data import OmniDiffusionConfig
|
||||
from vllm_omni.diffusion.model_loader.host_weights.identity_adapter import FinalLayoutIdentityContext
|
||||
from vllm_omni.diffusion.model_loader.host_weights.source_identity import (
|
||||
NodeSourceDigestCache,
|
||||
@@ -40,6 +41,8 @@ class _HWRCommitError(RuntimeError):
|
||||
class HWRLoaderMixin:
|
||||
"""Optional final-layout HWR behavior shared by diffusion loaders."""
|
||||
|
||||
od_config: OmniDiffusionConfig
|
||||
|
||||
@staticmethod
|
||||
def _identity_value(value: object) -> object:
|
||||
"""Convert config objects into deterministic identity metadata."""
|
||||
@@ -319,10 +322,12 @@ class HWRLoaderMixin:
|
||||
HostWeightLeaseCarrier,
|
||||
HostWeightRuntime,
|
||||
HostWeightRuntimeConfig,
|
||||
IntegrityPolicy,
|
||||
ProductionPolicy,
|
||||
ResolutionOutcome,
|
||||
RuntimeMode,
|
||||
StorageDomainPolicy,
|
||||
ValidationLevel,
|
||||
)
|
||||
from vllm_omni.host_weight_runtime.filesystem import detect_storage_class
|
||||
|
||||
@@ -363,6 +368,11 @@ class HWRLoaderMixin:
|
||||
HostWeightRuntimeConfig(
|
||||
mode=mode,
|
||||
domain=StorageDomainPolicy(root=root, storage_class=detect_storage_class(root)),
|
||||
integrity=IntegrityPolicy(
|
||||
local_lookup=ValidationLevel(
|
||||
getattr(self.od_config, "host_weight_runtime_validation", "manifest_and_metadata")
|
||||
),
|
||||
),
|
||||
production=ProductionPolicy(
|
||||
allow_local_build=False,
|
||||
allow_post_load_publish=True,
|
||||
|
||||
Reference in new issue
Block a user