[Diffusion] Simplify DLO host plan setup

Signed-off-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
Hongsheng Liu committed 2026-08-19 23:00:31 +08:00
1 parent 6bcd350301
commit 58eebee14b
7 files changed
+77 -37

No files matched your search

@@ -401,7 +401,6 @@ def _validate_entry(
backing_kind="host_weight_cache",
bindings=bindings,
runtime_layout_key=cache_key,
post_load_complete=True,
expected_file_digests={
str(entry_dir / filename): metadata["sha256"] for filename, metadata in file_manifest.items()
},
@@ -9,6 +9,7 @@ import json
import os
from collections.abc import Callable, Sequence
from dataclasses import dataclass
from typing import Literal
import torch
from safetensors import safe_open
@@ -37,13 +38,17 @@ class TensorBinding:
class HostWeightPlan:
"""Complete, prevalidated host backing consumed by an offload backend."""
backing_kind: str
backing_kind: Literal["checkpoint_mmap", "host_weight_cache"]
bindings: dict[str, TensorBinding]
planned_source_prefixes: frozenset[str] = frozenset()
runtime_layout_key: str | None = None
post_load_complete: bool = False
expected_file_digests: dict[str, str] | None = None
@property
def requires_backend(self) -> bool:
"""Whether ordinary loading was skipped and this plan must be consumed."""
return self.backing_kind == "checkpoint_mmap"
@dataclass(frozen=True)
class HostWeightPlanResult: