[diffusion] chore: fix ZMQ binding and model loading for FastWan compatibility (#13978)
Co-authored-by: Han Yu <hyu5@dt-login01.delta.ncsa.illinois.edu> Co-authored-by: Mick <mickjagger19@icloud.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -728,6 +728,7 @@ class TransformerLoader(ComponentLoader):
|
||||
param_dtype=torch.bfloat16,
|
||||
reduce_dtype=torch.float32,
|
||||
output_dtype=None,
|
||||
strict=False,
|
||||
)
|
||||
|
||||
total_params = sum(p.numel() for p in model.parameters())
|
||||
|
||||
@@ -79,6 +79,7 @@ def maybe_load_fsdp_model(
|
||||
fsdp_inference: bool = False,
|
||||
output_dtype: torch.dtype | None = None,
|
||||
pin_cpu_memory: bool = True,
|
||||
strict: bool = True,
|
||||
) -> torch.nn.Module:
|
||||
"""
|
||||
Load the model with FSDP if is training, else load the model without FSDP.
|
||||
@@ -138,7 +139,7 @@ def maybe_load_fsdp_model(
|
||||
weight_iterator,
|
||||
device,
|
||||
default_dtype,
|
||||
strict=True,
|
||||
strict=strict,
|
||||
cpu_offload=cpu_offload,
|
||||
param_names_mapping=param_names_mapping_fn,
|
||||
)
|
||||
@@ -255,9 +256,15 @@ def load_model_from_full_model_state_dict(
|
||||
for target_param_name, full_tensor in custom_param_sd.items():
|
||||
meta_sharded_param = meta_sd.get(target_param_name)
|
||||
if meta_sharded_param is None:
|
||||
raise ValueError(
|
||||
f"Parameter {target_param_name} not found in custom model state dict. The hf to custom mapping may be incorrect."
|
||||
)
|
||||
if strict:
|
||||
raise ValueError(
|
||||
f"Parameter {target_param_name} not found in custom model state dict. The hf to custom mapping may be incorrect."
|
||||
)
|
||||
else:
|
||||
logger.warning(
|
||||
f"Parameter '{target_param_name}' from checkpoint not found in model; skipping. This is expected for optional parameters."
|
||||
)
|
||||
continue
|
||||
if not hasattr(meta_sharded_param, "device_mesh"):
|
||||
full_tensor = full_tensor.to(device=device, dtype=param_dtype)
|
||||
actual_param = param_dict.get(target_param_name)
|
||||
|
||||
Reference in New Issue
Block a user