Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xuwx1
LightX2V
Commits
145161cd
Commit
145161cd
authored
Jul 24, 2025
by
gaclove
Browse files
fix: add size mismatch handling for prev_latents in VideoGenerator to ensure consistent dimensions
parent
edeae441
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
lightx2v/models/runners/wan/wan_audio_runner.py
lightx2v/models/runners/wan/wan_audio_runner.py
+18
-0
No files found.
lightx2v/models/runners/wan/wan_audio_runner.py
View file @
145161cd
...
@@ -292,6 +292,15 @@ class VideoGenerator:
...
@@ -292,6 +292,15 @@ class VideoGenerator:
prev_mask
=
torch
.
ones
((
1
,
frames_n
,
height
,
width
),
device
=
device
,
dtype
=
dtype
)
prev_mask
=
torch
.
ones
((
1
,
frames_n
,
height
,
width
),
device
=
device
,
dtype
=
dtype
)
prev_mask
[:,
prev_frame_len
:]
=
0
prev_mask
[:,
prev_frame_len
:]
=
0
prev_mask
=
self
.
_wan_mask_rearrange
(
prev_mask
).
unsqueeze
(
0
)
prev_mask
=
self
.
_wan_mask_rearrange
(
prev_mask
).
unsqueeze
(
0
)
if
prev_latents
.
shape
[
-
2
:]
!=
(
height
,
width
):
logger
.
warning
(
f
"Size mismatch: prev_latents
{
prev_latents
.
shape
}
vs scheduler latents (H=
{
height
}
, W=
{
width
}
). Config tgt_h=
{
self
.
config
.
tgt_h
}
, tgt_w=
{
self
.
config
.
tgt_w
}
"
)
prev_latents
=
torch
.
nn
.
functional
.
interpolate
(
prev_latents
,
size
=
(
height
,
width
),
mode
=
'bilinear'
,
align_corners
=
False
)
return
{
"prev_latents"
:
prev_latents
,
"prev_mask"
:
prev_mask
}
return
{
"prev_latents"
:
prev_latents
,
"prev_mask"
:
prev_mask
}
...
@@ -349,6 +358,15 @@ class VideoGenerator:
...
@@ -349,6 +358,15 @@ class VideoGenerator:
prev_mask
=
torch
.
ones
((
1
,
frames_n
,
height
,
width
),
device
=
device
,
dtype
=
dtype
)
prev_mask
=
torch
.
ones
((
1
,
frames_n
,
height
,
width
),
device
=
device
,
dtype
=
dtype
)
prev_mask
[:,
prev_frame_len
:]
=
0
prev_mask
[:,
prev_frame_len
:]
=
0
prev_mask
=
self
.
_wan_mask_rearrange
(
prev_mask
).
unsqueeze
(
0
)
prev_mask
=
self
.
_wan_mask_rearrange
(
prev_mask
).
unsqueeze
(
0
)
if
prev_latents
.
shape
[
-
2
:]
!=
(
height
,
width
):
logger
.
warning
(
f
"Size mismatch: prev_latents
{
prev_latents
.
shape
}
vs scheduler latents (H=
{
height
}
, W=
{
width
}
). Config tgt_h=
{
self
.
config
.
tgt_h
}
, tgt_w=
{
self
.
config
.
tgt_w
}
"
)
prev_latents
=
torch
.
nn
.
functional
.
interpolate
(
prev_latents
,
size
=
(
height
,
width
),
mode
=
'bilinear'
,
align_corners
=
False
)
# Always set previmg_encoder_output
# Always set previmg_encoder_output
inputs
[
"previmg_encoder_output"
]
=
{
"prev_latents"
:
prev_latents
,
"prev_mask"
:
prev_mask
}
inputs
[
"previmg_encoder_output"
]
=
{
"prev_latents"
:
prev_latents
,
"prev_mask"
:
prev_mask
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment