fix: Ensure more specific Wan model keys match first

The issue was that model IDs like 'wan2_2_i2v_a14b' would match
'wan2_2' (T2V) before 'wan2_2_i2v' (I2V) because 'wan2_2' comes
first in the dictionary.

Now the dictionary is ordered with more specific keys first:
- wan2_2_i2v_a14b (most specific)
- wan2.2_i2v_a14b
- wan2_2_i2v
- wan2.2_i2v
- wan2_2
- wan2.2
etc.

This ensures longer/more specific keys are checked before shorter ones.
parent ec05b598
......@@ -9199,17 +9199,21 @@ def main(args):
base_model_fallbacks = {
"ltx": "Lightricks/LTX-Video",
"ltxvideo": "Lightricks/LTX-Video",
# Wan 2.2 I2V models
# Wan models - more specific keys MUST come first!
# (longer keys checked first so wan2_2_i2v matches before wan2_2)
"wan2_2_i2v_a14b": "Wan-AI/Wan2.2-I2V-14B-Diffusers",
"wan2.2_i2v_a14b": "Wan-AI/Wan2.2-I2V-14B-Diffusers",
"wan2_2_i2v": "Wan-AI/Wan2.2-I2V-14B-Diffusers",
"wan2.2_i2v": "Wan-AI/Wan2.2-I2V-14B-Diffusers",
"wan2_2": "Wan-AI/Wan2.2-T2V-14B-Diffusers",
"wan2.2": "Wan-AI/Wan2.2-T2V-14B-Diffusers",
# Wan 2.1 models
"wan2_1_i2v_a14b": "Wan-AI/Wan2.1-I2V-14B-Diffusers",
"wan2.1_i2v_a14b": "Wan-AI/Wan2.1-I2V-14B-Diffusers",
"wan2_1_i2v": "Wan-AI/Wan2.1-I2V-14B-Diffusers",
"wan2.1_i2v": "Wan-AI/Wan2.1-I2V-14B-Diffusers",
"wan2_1": "Wan-AI/Wan2.1-T2V-14B-Diffusers",
"wan2.1": "Wan-AI/Wan2.1-T2V-14B-Diffusers",
# Generic Wan fallback
# Generic Wan fallback (least specific - checked last)
"wan": "Wan-AI/Wan2.1-T2V-14B-Diffusers",
"svd": "stabilityai/stable-video-diffusion-img2vid-xt-1-1",
"cogvideo": "THUDM/CogVideoX-5b",
......
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