Honor the resolved family default when no identifier names a video variant
default_video_generation_params fell back to a hardcoded LTX 40/4.0 when no identifier matched. A Wan model loaded from an opaque local path under an explicit family_override (none of gguf_filename / repo_id / base_repo carrying a wan token) then ran 40/4.0 instead of Wan's 50/5.0. Add a fallback param and pass the resolved family's own default_steps/default_guidance from both call sites, so the fallback tracks the actual family.
This commit is contained in:
parent
cc71be93f2
commit
790b41f262
3 changed files with 27 additions and 5 deletions
|
|
@ -1179,7 +1179,10 @@ class VideoBackend:
|
|||
frames = snap_num_frames(fam, num_frames or fam.default_num_frames)
|
||||
out_fps = int(fps or fam.default_fps)
|
||||
default_steps, default_guidance = default_video_generation_params(
|
||||
state.gguf_filename, state.repo_id, state.base_repo
|
||||
state.gguf_filename,
|
||||
state.repo_id,
|
||||
state.base_repo,
|
||||
fallback = (fam.default_steps, fam.default_guidance),
|
||||
)
|
||||
steps = int(steps or default_steps)
|
||||
guidance = float(default_guidance if guidance is None else guidance)
|
||||
|
|
@ -1384,7 +1387,10 @@ class VideoBackend:
|
|||
}
|
||||
fam = state.family
|
||||
default_steps, default_guidance = default_video_generation_params(
|
||||
state.gguf_filename, state.repo_id, state.base_repo
|
||||
state.gguf_filename,
|
||||
state.repo_id,
|
||||
state.base_repo,
|
||||
fallback = (fam.default_steps, fam.default_guidance),
|
||||
)
|
||||
return {
|
||||
"loaded": True,
|
||||
|
|
|
|||
|
|
@ -279,13 +279,17 @@ _VIDEO_GENERATION_DEFAULTS: tuple[tuple[str, int, float], ...] = (
|
|||
)
|
||||
|
||||
|
||||
def default_video_generation_params(*identifiers: Optional[str]) -> tuple[int, float]:
|
||||
def default_video_generation_params(
|
||||
*identifiers: Optional[str], fallback: tuple[int, float] = (40, 4.0)
|
||||
) -> tuple[int, float]:
|
||||
"""Default ``(steps, guidance)`` for a loaded video model; the first identifier
|
||||
naming a known variant wins, so a GGUF filename ('...distilled...Q4_K_M.gguf')
|
||||
beats the family base repo."""
|
||||
beats the family base repo. ``fallback`` is used when no identifier names a variant --
|
||||
callers pass the resolved family's own default so a Wan model loaded from an opaque local
|
||||
path under an explicit family_override still gets 50/5.0, not the hardcoded LTX 40/4.0."""
|
||||
for identifier in identifiers:
|
||||
needle = (identifier or "").lower()
|
||||
for key, steps, guidance in _VIDEO_GENERATION_DEFAULTS:
|
||||
if key in needle:
|
||||
return steps, guidance
|
||||
return 40, 4.0
|
||||
return fallback
|
||||
|
|
|
|||
|
|
@ -178,6 +178,18 @@ def test_wan_generation_defaults():
|
|||
) == (50, 5.0)
|
||||
|
||||
|
||||
def test_generation_defaults_fallback_honors_family():
|
||||
# When no identifier names a known variant (a Wan model loaded from an opaque local path under
|
||||
# an explicit family_override), the fallback -- the resolved family's own default -- is used,
|
||||
# not the hardcoded LTX 40/4.0. Without a family fallback a Wan model would wrongly run 40/4.0.
|
||||
assert default_video_generation_params("/models/my-clip", "/models/my-clip") == (40, 4.0)
|
||||
assert default_video_generation_params(
|
||||
"/models/my-clip", "/models/my-clip", fallback = (50, 5.0)
|
||||
) == (50, 5.0)
|
||||
# A recognised token still wins over the fallback.
|
||||
assert default_video_generation_params("wan2.2-ti2v-5b", fallback = (8, 1.0)) == (50, 5.0)
|
||||
|
||||
|
||||
def test_wan_size_tables_present():
|
||||
ti2v = detect_video_family("Wan-AI/Wan2.2-TI2V-5B-Diffusers")
|
||||
a14b = detect_video_family("Wan-AI/Wan2.2-T2V-A14B-Diffusers")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue