Add 404 fallback to deferred I2V model loading

- Apply same 404 fallback strategy to deferred I2V model loading
- Try DiffusionPipeline as fallback when model_index.json not found
- Ensures all model loading paths have consistent error handling
parent c2c62b60
......@@ -7226,8 +7226,31 @@ def main(args):
# Reload the I2V pipeline
try:
pipe = PipelineClass.from_pretrained(model_id_to_load, **pipe_kwargs)
except Exception as e:
error_str = str(e)
# Check if this is a 404 error for model_index.json
is_404_error = "404" in error_str or "Entry Not Found" in error_str or "not found" in error_str.lower()
# Apply LoRA if this is a LoRA model
if is_404_error and "model_index.json" in error_str:
print(f"\n⚠️ I2V model model_index.json not found at root level")
print(f" Attempting alternative loading strategies...")
# Try with DiffusionPipeline (generic loader)
try:
print(f" Trying generic DiffusionPipeline for I2V model...")
from diffusers import DiffusionPipeline
pipe = DiffusionPipeline.from_pretrained(model_id_to_load, **pipe_kwargs)
print(f" ✅ Successfully loaded I2V model with DiffusionPipeline")
PipelineClass = DiffusionPipeline
except Exception as generic_e:
if debug:
print(f" [DEBUG] Generic loader also failed: {generic_e}")
raise e # Re-raise if fallback failed
else:
raise e # Re-raise for non-404 errors
# Apply LoRA if this is a LoRA model
if is_lora and lora_id:
print(f" Loading LoRA adapter: {lora_id}")
try:
......
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