Update city96_latent_upscaler.py

added a line on noise mask
This commit is contained in:
VALADI K JAGANATHAN
2023-11-30 07:55:23 +05:30
committed by GitHub
parent f3e6e6d506
commit 12c31e8967

View File

@@ -1,4 +1,5 @@
# https://github.com/city96/SD-Latent-Upscaler
# check if any issues on weights and updates and local install for same
import torch
import torch.nn as nn
from safetensors.torch import load_file
@@ -79,4 +80,9 @@ class LatentUpscaler:
lt = samples["samples"]
lt = model(lt)
del model
return ({"samples": lt},)
if "noise_mask" in samples.keys():
# expand the noise mask to the same shape as the latent
mask = torch.nn.functional.interpolate(samples['noise_mask'], scale_factor=float(scale_factor), mode='bicubic')
return ({"samples": lt, "noise_mask": mask},)
return ({"samples": lt},)