fix: support i2v resize modes with filled latent shape#1124
Conversation
`default_runner.read_image_input` only populated `input_info.latent_shape`
when `resize_mode == "adaptive"`, while `wan_runner.run_vae_encoder`'s
else-branch reads `input_info.latent_shape` unconditionally whenever
`resize_mode` is set. Picking any non-adaptive mode
(keep_ratio_fixed_area / fixed_min_area / fixed_max_area / fixed_shape /
fixed_min_side) therefore crashed with:
File ".../wan_runner.py", line 524, in run_vae_encoder
latent_h, latent_w = self.input_info.latent_shape[-2], ...[-1]
IndexError: list index out of range
`default_runner.resize_image` was also adaptive-only; rebuilt it to
handle all six modes the same way `wan_audio_runner.resize_image`
already does, then dropped the `== "adaptive"` gate in
`read_image_input` so any populated `resize_mode` runs the resize +
latent_shape / target_shape population path. Empty-string / missing
`resize_mode` still falls through to `run_vae_encoder`'s from-scratch
branch (back-compat with old configs).
Verified all 6 modes produce sensible h/w on portrait / landscape /
square inputs in isolation.
torchvision moved read_video from torchvision.io to torchvision.io.video in some versions. Add try/except fallback at both import sites.
Extract a module-level _get_read_video() with torchvision.io → torchvision.io.video → PyAV fallback chain so seedvr works even when torchvision is absent or has a different API surface.
There was a problem hiding this comment.
Code Review
This pull request expands the image resizing capabilities in default_runner.py to support multiple resize modes and adds a fallback mechanism for reading videos in seedvr_runner.py when torchvision is missing. The review feedback highlights opportunities to improve robustness, specifically by preventing dimensions from rounding to zero during resizing and latent shape calculation, and by adding proper error handling and resource cleanup to the PyAV video reading fallback.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary
Changes
lightx2v/models/runners/default_runner.pylightx2v/models/runners/seedvr/seedvr_runner.py