Add CPU fallback for latent upscale OOM
This commit is contained in:
@@ -602,6 +602,20 @@ def upscale_video_model(video, param):
|
||||
raise
|
||||
smaller = _shrink_model_tile_param(param)
|
||||
if smaller is None:
|
||||
if str(param.get("device", "cuda")) != "cpu":
|
||||
cpu_param = dict(param)
|
||||
cpu_param["device"] = "cpu"
|
||||
cpu_param["precision"] = "fp32"
|
||||
try:
|
||||
gc.collect()
|
||||
except Exception:
|
||||
pass
|
||||
if torch.cuda.is_available():
|
||||
try:
|
||||
torch.cuda.empty_cache()
|
||||
except Exception:
|
||||
pass
|
||||
return upscale_video_model(video, cpu_param)
|
||||
raise
|
||||
try:
|
||||
gc.collect()
|
||||
|
||||
Reference in New Issue
Block a user