Fix: Wrap LoRA loading and offloading in defer_i2v_loading check

When defer_i2v_loading=True (I2V mode without provided image), the code
sets pipe=None but then tried to call pipe.load_lora_weights() and
pipe.enable_model_cpu_offload() on None, causing AttributeError.

This fix wraps the LoRA loading and offloading configuration blocks
inside an 'if not defer_i2v_loading:' condition so they are skipped
when the I2V model loading is deferred until after image generation.
parent 0ccc1d52
Pipeline #237 failed with stages
...@@ -3938,6 +3938,8 @@ def main(args): ...@@ -3938,6 +3938,8 @@ def main(args):
timing.end_step() # model_loading timing.end_step() # model_loading
# Only apply LoRA and offloading if we actually loaded the model (not deferred)
if not defer_i2v_loading:
# Apply LoRA if this is a LoRA model # Apply LoRA if this is a LoRA model
if is_lora and lora_id: if is_lora and lora_id:
timing.begin_step("lora_loading") timing.begin_step("lora_loading")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment