[Refactor][Diffusion] Read the resolved offload policy outside the config layer (#7327)

Signed-off-by: specture724 <specture724@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
authored and GitHub committed 2026-09-26 17:45:20 +08:00
1 parent ad025defe6
commit acf6620233
22 files changed
+265 -111

No files matched your search

+13
View File
@@ -356,6 +356,19 @@ def resolve_offload_strategy(config: Any) -> OffloadStrategy:
return resolve_offload(config).strategy
def offload_enabled(config: Any) -> bool:
"""Return whether any CPU-offload policy is active."""
return resolve_offload(config).strategy is not OffloadStrategy.NONE
def offload_streams_blocks(config: Any) -> bool:
"""Return whether an active policy streams weights block by block."""
return resolve_offload(config).strategy in (
OffloadStrategy.LAYER_WISE,
OffloadStrategy.DISTRIBUTED_LAYER_WISE,
)
def materialize_legacy_offload_flags(config: Any) -> OffloadStrategy:
"""Keep existing strategy readers working after resolving the compact API."""
resolved = resolve_offload(config)