Fix: Restore natural look for 7b model (v2.5.6)

- Replace split-stack-mean with unflatten in unconcat_coalesce
- Corrects computation order to eliminate plastic/high-specular artifacts
- Maintains torch.compile compatibility (no .item() graph breaks)
- Applied to both dit_3b and dit_7b models
This commit is contained in:
Adrien Toupet
2025-11-09 12:26:18 -05:00
parent 668382d076
commit a3f98124ca
4 changed files with 16 additions and 20 deletions
+3 -1
View File
@@ -36,7 +36,9 @@ We're actively working on improvements and new features. To stay informed:
## 🚀 Updates
**2025.11.09 - Version 2.5.5**
**2025.11.09 - Version 2.5.6**
- 🎨 **Fix: Restored natural look for 7b model** - Corrected torch.compile optimization that was causing overly plastic/ high-specular appearance in upscaled videos with 7b model.
- 💾 **Memory: Fixed RAM leak for long videos** - On-demand reconstruction with lightweight batch indices instead of storing full transformed videos, fixed release_tensor_memory to handle CPU/CUDA/MPS consistently, and refactored batch processing helpers
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "seedvr2_videoupscaler"
description = "SeedVR2 official ComfyUI integration: ByteDance-Seed's one-step diffusion-based video/image upscaling with memory-efficient inference"
version = "2.5.5"
version = "2.5.6"
authors = [
{name = "numz"},
{name = "adrientoupet"}
+6 -9
View File
@@ -400,22 +400,19 @@ def repeat_concat_idx(
The text features appear multiple times (once per window) and need
to be averaged to produce a single set of text features.
COMPILE OPTIMIZATION: Uses split-stack-mean instead of reshape to avoid .item()
COMPILE OPTIMIZATION: Uses unflatten with tensor dims (compile-friendly)
"""
vid_out, txt_out = all[src_idx].split([len(vid_idx), txt_idx_len])
# Coalesce repeated text using pure tensor operations (no .item())
# Coalesce repeated text using unflatten and mean
txt_splits = _tensor_split(txt_out, repeat_txt_len, dim=0)
txt_out_coalesced = []
for txt, base_len in zip(txt_splits, txt_len):
for txt in txt_splits:
# txt has shape (base_len * num_repeats, *other_dims)
# Split into num_repeats equal pieces using tensor operations
split_lens = base_len.unsqueeze(0).repeat_interleave(num_repeats_tensor.squeeze())
pieces = _tensor_split(txt, split_lens, dim=0)
# Stack and average across repetitions
txt_avg = torch.stack(pieces, dim=0).mean(0)
txt_out_coalesced.append(txt_avg)
# unflatten to (base_len, num_repeats, *other_dims) then average dim 1
txt = txt.unflatten(0, (-1, num_repeats_tensor.squeeze())).mean(1)
txt_out_coalesced.append(txt)
return vid_out, torch.cat(txt_out_coalesced)
+6 -9
View File
@@ -400,22 +400,19 @@ def repeat_concat_idx(
The text features appear multiple times (once per window) and need
to be averaged to produce a single set of text features.
COMPILE OPTIMIZATION: Uses split-stack-mean instead of reshape to avoid .item()
COMPILE OPTIMIZATION: Uses unflatten with tensor dims (compile-friendly)
"""
vid_out, txt_out = all[src_idx].split([len(vid_idx), txt_idx_len])
# Coalesce repeated text using pure tensor operations (no .item())
# Coalesce repeated text using unflatten and mean
txt_splits = _tensor_split(txt_out, repeat_txt_len, dim=0)
txt_out_coalesced = []
for txt, base_len in zip(txt_splits, txt_len):
for txt in txt_splits:
# txt has shape (base_len * num_repeats, *other_dims)
# Split into num_repeats equal pieces using tensor operations
split_lens = base_len.unsqueeze(0).repeat_interleave(num_repeats_tensor.squeeze())
pieces = _tensor_split(txt, split_lens, dim=0)
# Stack and average across repetitions
txt_avg = torch.stack(pieces, dim=0).mean(0)
txt_out_coalesced.append(txt_avg)
# unflatten to (base_len, num_repeats, *other_dims) then average dim 1
txt = txt.unflatten(0, (-1, num_repeats_tensor.squeeze())).mean(1)
txt_out_coalesced.append(txt)
return vid_out, torch.cat(txt_out_coalesced)