[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:
22 files changed
+265
-111
No files matched your search
@@ -46,7 +46,12 @@ from vllm_omni.diffusion.models.wan2_2.pipeline_wan2_2 import (
|
||||
from vllm_omni.diffusion.models.wan2_2.wan2_2_s2v_transformer import (
|
||||
create_s2v_transformer_from_config,
|
||||
)
|
||||
from vllm_omni.diffusion.offloader.config import DIT_COMPONENT, selected_offload_components
|
||||
from vllm_omni.diffusion.offloader.config import (
|
||||
DIT_COMPONENT,
|
||||
OffloadStrategy,
|
||||
resolve_offload_strategy,
|
||||
selected_offload_components,
|
||||
)
|
||||
from vllm_omni.diffusion.profiler.diffusion_pipeline_profiler import DiffusionPipelineProfilerMixin
|
||||
from vllm_omni.diffusion.request import OmniDiffusionRequest
|
||||
from vllm_omni.diffusion.utils.chunked_video import ChunkedVideoMP4Session
|
||||
@@ -659,7 +664,10 @@ class Wan22S2VPipeline(
|
||||
|
||||
t5_checkpoint = os.path.join(model_path, "models_t5_umt5-xxl-enc-bf16.pth")
|
||||
self.text_encoder = UMT5EncoderModel(_WAN_UMT5_CONFIG)
|
||||
_cpu_offload = self.od_config.enable_cpu_offload or self.od_config.enable_layerwise_offload
|
||||
_cpu_offload = resolve_offload_strategy(self.od_config) in (
|
||||
OffloadStrategy.MODEL_LEVEL,
|
||||
OffloadStrategy.LAYER_WISE,
|
||||
)
|
||||
self.text_encoder = _load_wan_t5_as_umt5(self.text_encoder, t5_checkpoint, dtype=dtype)
|
||||
if not _cpu_offload:
|
||||
self.text_encoder = self.text_encoder.to(self.device)
|
||||
@@ -1108,7 +1116,9 @@ class Wan22S2VPipeline(
|
||||
def _should_release_dit_before_decode(self) -> bool:
|
||||
if getattr(self.od_config.parallel_config, "use_hsdp", False):
|
||||
return False
|
||||
return self.od_config.enable_cpu_offload and DIT_COMPONENT in selected_offload_components(self.od_config)
|
||||
return resolve_offload_strategy(self.od_config) is OffloadStrategy.MODEL_LEVEL and (
|
||||
DIT_COMPONENT in selected_offload_components(self.od_config)
|
||||
)
|
||||
|
||||
def forward(
|
||||
self,
|
||||
|
||||
Reference in new issue
Block a user