try replacing NaN and clipping large values to reduce noise
This commit is contained in:
parent
f24a3ab287
commit
4460625309
|
@ -28,7 +28,7 @@ from transformers import CLIPImageProcessor, CLIPTokenizer
|
||||||
|
|
||||||
from onnx_web.chain.tile import make_tile_mask
|
from onnx_web.chain.tile import make_tile_mask
|
||||||
|
|
||||||
from ..utils import LATENT_CHANNELS, LATENT_FACTOR, parse_regions
|
from ..utils import LATENT_CHANNELS, LATENT_FACTOR, parse_regions, repair_nan
|
||||||
|
|
||||||
logger = logging.get_logger(__name__)
|
logger = logging.get_logger(__name__)
|
||||||
|
|
||||||
|
@ -701,6 +701,8 @@ class OnnxStableDiffusionPanoramaPipeline(DiffusionPipeline):
|
||||||
|
|
||||||
# take the MultiDiffusion step. Eq. 5 in MultiDiffusion paper: https://arxiv.org/abs/2302.08113
|
# take the MultiDiffusion step. Eq. 5 in MultiDiffusion paper: https://arxiv.org/abs/2302.08113
|
||||||
latents = np.where(count > 0, value / count, value)
|
latents = np.where(count > 0, value / count, value)
|
||||||
|
latents = repair_nan(latents)
|
||||||
|
latents = np.clip(latents, -4, +4)
|
||||||
|
|
||||||
# call the callback, if provided
|
# call the callback, if provided
|
||||||
if callback is not None and i % callback_steps == 0:
|
if callback is not None and i % callback_steps == 0:
|
||||||
|
|
|
@ -14,7 +14,7 @@ from optimum.pipelines.diffusers.pipeline_utils import preprocess, rescale_noise
|
||||||
|
|
||||||
from onnx_web.chain.tile import make_tile_mask
|
from onnx_web.chain.tile import make_tile_mask
|
||||||
|
|
||||||
from ..utils import LATENT_FACTOR, parse_regions
|
from ..utils import LATENT_FACTOR, parse_regions, repair_nan
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -550,6 +550,8 @@ class StableDiffusionXLPanoramaPipelineMixin(StableDiffusionXLImg2ImgPipelineMix
|
||||||
|
|
||||||
# take the MultiDiffusion step. Eq. 5 in MultiDiffusion paper: https://arxiv.org/abs/2302.08113
|
# take the MultiDiffusion step. Eq. 5 in MultiDiffusion paper: https://arxiv.org/abs/2302.08113
|
||||||
latents = np.where(count > 0, value / count, value)
|
latents = np.where(count > 0, value / count, value)
|
||||||
|
latents = repair_nan(latents)
|
||||||
|
latents = np.clip(latents, -4, +4)
|
||||||
|
|
||||||
# call the callback, if provided
|
# call the callback, if provided
|
||||||
if i == len(timesteps) - 1 or (
|
if i == len(timesteps) - 1 or (
|
||||||
|
|
Loading…
Reference in New Issue