working ok
This commit is contained in:
@@ -64,32 +64,39 @@ def test_lora_parse_full():
|
||||
{
|
||||
"loras": [
|
||||
{
|
||||
"path": "/tmp/hi.safetensors",
|
||||
"path": "/tmp/a.safetensors",
|
||||
"weight": 0.7,
|
||||
"target": "high_noise",
|
||||
"name": "hi-noise-style",
|
||||
"target": "both",
|
||||
"name": "style-a",
|
||||
},
|
||||
{
|
||||
"path": "/tmp/lo.safetensors",
|
||||
"path": "/tmp/b.safetensors",
|
||||
"weight": 0.4,
|
||||
"target": "low_noise",
|
||||
"name": "lo-noise-style",
|
||||
"target": "both",
|
||||
"name": "style-b",
|
||||
},
|
||||
]
|
||||
}
|
||||
)
|
||||
assert len(cfg.loras) == 2
|
||||
assert cfg.loras[0].target == "high_noise"
|
||||
assert cfg.loras[0].name == "hi-noise-style"
|
||||
assert cfg.loras[1].target == "low_noise"
|
||||
assert cfg.loras[0].target == "both"
|
||||
assert cfg.loras[0].name == "style-a"
|
||||
assert cfg.loras[1].target == "both"
|
||||
assert cfg.loras[1].weight == 0.4
|
||||
|
||||
|
||||
def test_lora_invalid_target_falls_back_to_both():
|
||||
def test_lora_legacy_moe_target_coerced_to_both():
|
||||
"""Legacy MoE configs with target='high_noise'/'low_noise' get coerced."""
|
||||
cfg = VideoConfig.from_dict(
|
||||
{"loras": [{"path": "/tmp/x.safetensors", "target": "bogus"}]}
|
||||
{
|
||||
"loras": [
|
||||
{"path": "/tmp/hi.safetensors", "target": "high_noise"},
|
||||
{"path": "/tmp/lo.safetensors", "target": "low_noise"},
|
||||
{"path": "/tmp/x.safetensors", "target": "bogus"},
|
||||
]
|
||||
}
|
||||
)
|
||||
assert cfg.loras[0].target == "both"
|
||||
assert all(l.target == "both" for l in cfg.loras)
|
||||
|
||||
|
||||
def test_lora_entries_without_path_are_dropped():
|
||||
@@ -107,8 +114,8 @@ def test_models_section_override():
|
||||
"wan22_base_repo": "/local/weights/wan22",
|
||||
"wan22_dit_repo": "/local/weights/wan22-dit",
|
||||
"wan22_dit_quant_scheme": "gguf-Q4_K_M",
|
||||
"wan22_config_json": "/local/cfg/fp8.json",
|
||||
"wan22_model_cls": "wan2.2_moe",
|
||||
"wan22_config_json": "/local/cfg/turbo.json",
|
||||
"wan22_model_cls": "wan2.2",
|
||||
"musetalk_path": "/local/weights/musetalk",
|
||||
}
|
||||
}
|
||||
@@ -116,18 +123,16 @@ def test_models_section_override():
|
||||
assert cfg.wan22_base_repo == "/local/weights/wan22"
|
||||
assert cfg.wan22_dit_repo == "/local/weights/wan22-dit"
|
||||
assert cfg.wan22_dit_quant_scheme == "gguf-Q4_K_M"
|
||||
assert cfg.wan22_config_json == "/local/cfg/fp8.json"
|
||||
assert cfg.wan22_model_cls == "wan2.2_moe"
|
||||
assert cfg.wan22_config_json == "/local/cfg/turbo.json"
|
||||
assert cfg.wan22_model_cls == "wan2.2"
|
||||
assert cfg.musetalk_model_path == "/local/weights/musetalk"
|
||||
|
||||
|
||||
def test_models_section_backwards_compat_fp8_repo():
|
||||
"""Old config key wan22_fp8_repo still works via fallback."""
|
||||
cfg = VideoConfig.from_dict(
|
||||
{
|
||||
"models": {
|
||||
"wan22_fp8_repo": "/local/weights/wan22-fp8",
|
||||
}
|
||||
}
|
||||
)
|
||||
assert cfg.wan22_dit_repo == "/local/weights/wan22-fp8"
|
||||
def test_models_section_defaults_to_5b_turbo():
|
||||
cfg = VideoConfig.from_dict({})
|
||||
assert cfg.wan22_base_repo == "Wan-AI/Wan2.2-TI2V-5B"
|
||||
assert cfg.wan22_dit_repo == "hum-ma/Wan2.2-TI2V-5B-Turbo-GGUF"
|
||||
assert cfg.wan22_dit_quant_scheme == "gguf-Q8_0"
|
||||
assert cfg.wan22_t5_quantized is True
|
||||
assert cfg.wan22_model_cls == "wan2.2"
|
||||
assert cfg.wan22_config_json == "/app/configs/lightx2v/wan22_i2v_gguf_5b_turbo.json"
|
||||
|
||||
Reference in New Issue
Block a user