Reduce latent upscale VRAM pressure
This commit is contained in:
@@ -541,39 +541,14 @@ def _shrink_model_tile_param(param):
|
||||
|
||||
|
||||
def _shrink_temporal_param(param):
|
||||
def _lower_17(v):
|
||||
v = int(v or 0)
|
||||
if v <= 0:
|
||||
return 0
|
||||
v = (v // 2 // 17) * 17
|
||||
return max(0, v)
|
||||
|
||||
next_param = dict(param)
|
||||
chunk_length = int(next_param.get("chunk_length", 0) or 0)
|
||||
temporal_overlap = int(next_param.get("temporal_overlap", 0) or 0)
|
||||
if chunk_length <= 17:
|
||||
return None
|
||||
|
||||
new_chunk_length = _lower_17(chunk_length)
|
||||
if new_chunk_length < 17:
|
||||
new_chunk_length = chunk_length - 17
|
||||
if new_chunk_length < 17:
|
||||
return None
|
||||
if new_chunk_length >= chunk_length:
|
||||
new_chunk_length = chunk_length - 17
|
||||
if new_chunk_length < 17:
|
||||
return None
|
||||
|
||||
new_overlap = min(_lower_17(temporal_overlap), max(0, new_chunk_length - 17))
|
||||
if new_overlap >= new_chunk_length:
|
||||
new_overlap = max(0, new_chunk_length - 17)
|
||||
if new_overlap >= new_chunk_length:
|
||||
new_overlap = 0
|
||||
if new_overlap >= new_chunk_length:
|
||||
return None
|
||||
|
||||
next_param["chunk_length"] = new_chunk_length
|
||||
next_param["temporal_overlap"] = new_overlap
|
||||
next_param["chunk_length"] = 17
|
||||
next_param["temporal_overlap"] = 0
|
||||
return next_param
|
||||
|
||||
|
||||
@@ -746,6 +721,8 @@ def upscale_video_interp(video, param):
|
||||
|
||||
|
||||
def _upscale_video_temporal_chunks(video, param, upscaler):
|
||||
if video.device.type != "cpu":
|
||||
video = video.to(device="cpu", copy=True)
|
||||
chunk_length = int(param.get("chunk_length", 0) or 0)
|
||||
temporal_overlap = int(param.get("temporal_overlap", 0) or 0)
|
||||
anchor_strength = float(param.get("anchor_strength", 0.999) or 0.999)
|
||||
|
||||
Reference in New Issue
Block a user