From f0cd2ad381438e156101a8e39d8f47e75ece57af Mon Sep 17 00:00:00 2001 From: Jaylen Lee Date: Thu, 28 Mar 2024 15:08:11 +0800 Subject: [PATCH] update --- README.md | 21 +++++++++++++++++---- README_CN.md | 20 +++++++++++++++----- scripts/tileglobal.py | 8 ++------ tile_methods/demofusion.py | 4 ---- 4 files changed, 34 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 7add1e0..416cf0b 100644 --- a/README.md +++ b/README.md @@ -189,19 +189,32 @@ The extension enables **large image drawing & upscaling with limited VRAM** via ### Demofusion available -ℹ Ticking the random jitter usually yields better results. +ℹ The execution time of Demofusion will be relatively long, but it can obtain multiple images of different resolutions at once. Just like tilediffusion, please enable tilevae when an OOM error occurs. ℹ Recommend using higher steps, such as 30 or more, for better results -ℹ If you set the image size to 512 * 512, the appropriate window size and overlap are 64 and 32 or smaller. If it is 1024, it is recommended to double it. +ℹ If you set the image size to 512 * 512, the appropriate window size and overlap are 64 and 32 or smaller. If it is 1024, it is recommended to double it, and so on. ℹ Recommend using a higher denoising strength in img2img, maybe 0.8-1,and try to use the original model, seeds, and prompt as much as possible ℹ Do not enable it together with tilediffusion. It supports operations such as tilevae, noise inversion, etc. -ℹ For parameters such as c1, c2, and c3, please refer to the demofusion. You don't have to adjust it. +ℹ Due to differences in implementation details, parameters such as c1, c2, c3 and sigma can refer to the [demofusion](https://ruoyidu.github.io/demofusion/demofusion.html), but may not be entirely effective sometimes. If there are blurred images, it is recommended to increase c3 and reduce Sigma. -ℹ Euler sampler performs better +![demo-example](https://github.com/Jaylen-Lee/image-demo/blob/main/example.png?raw=true) + +#### Example: txt2img, 1024 * 1024 image 3x upscale + +- Params: + + - Step=45, sampler=Euler, same prompt as official demofusion, random seed 35, model SDXL1.0 + + - Denoising Strength for Substage = 0.85, Sigma=0.5,use default values for the rest,enable tilevae + + - Device: 4060ti 16GB + - The following are the images obtained at a resolution of 1024, 2048, and 3072 + + ![demo-result](https://github.com/Jaylen-Lee/image-demo/blob/main/3.png?raw=true) **** diff --git a/README_CN.md b/README_CN.md index 164ff64..3c33819 100644 --- a/README_CN.md +++ b/README_CN.md @@ -184,19 +184,29 @@ ### Demofusion现已可用 -ℹ 勾选随机抖动通常会得到更好的结果 +ℹ Demofusion的执行时间会比较长,不过可以一次得到多张不同分辨率的图片。与tilediffusion一样,出现OOM错误时请开启tilevae -ℹ推荐使用较高的步数,例如30步以上,往往会有更好的效果 +ℹ推荐使用较高的步数,例如30步以上,效果会更好 -ℹ如果你设定的生图大小是512*512, 合适的window size和overlap是64和32或者更小。如果是1024则推荐翻倍 +ℹ如果你设定的生图大小是512*512, 合适的window size和overlap是64和32或者更小。如果是1024则推荐翻倍,以此类推 ℹimg2img推荐使用较高的重绘幅度,比如0.8-1,并尽可能地使用原图的生图模型、随机种子以及prompt等 ℹ不要同时开启tilediffusion. 但该组件支持tilevae、noise inversion等常用功能 -ℹc1,c2,c3等参数可以参考demofusion. 你不必调整这些参数 +ℹ由于实现细节的差异,c1,c2,c3等参数可以参考[demofusion](https://ruoyidu.github.io/demofusion/demofusion.html)但不一定完全奏效. 如果出现模糊图像建议提高c3并降低Sigma -ℹ Euler采样器表现得更好 +![demo-example](https://github.com/Jaylen-Lee/image-demo/blob/main/example.png?raw=true) + +#### 示例 txt2img 1024*1024图片 3倍放大 + +- 参数: + - 步数 = 45,采样器 = Euler,与demofusion示例同样的提示语,随机种子35,模型为SDXL1.0 + - 子阶段降噪 = 0.85, Sigma=0.5,其余采用默认值,开启tilevae + - 设备 4060ti 16GB + - 以下为获得的1024,2048,3072分辨率的图片 + +![demo-result](https://github.com/Jaylen-Lee/image-demo/blob/main/3.png?raw=true) **** diff --git a/scripts/tileglobal.py b/scripts/tileglobal.py index fac770c..ebf8efc 100644 --- a/scripts/tileglobal.py +++ b/scripts/tileglobal.py @@ -79,9 +79,9 @@ class Script(scripts.Script): c1 = gr.Slider(minimum=0, maximum=5, step=0.01, label='Cosine Scale 1', value=3, elem_id=f'C1-{tab}') c2 = gr.Slider(minimum=0, maximum=5, step=0.01, label='Cosine Scale 2', value=1, elem_id=f'C2-{tab}') c3 = gr.Slider(minimum=0, maximum=5, step=0.01, label='Cosine Scale 3', value=1, elem_id=f'C3-{tab}') - sigma = gr.Slider(minimum=0, maximum=1, step=0.01, label='Sigma', value=0.4, elem_id=f'Sigma-{tab}') + sigma = gr.Slider(minimum=0, maximum=1, step=0.01, label='Sigma', value=0.5, elem_id=f'Sigma-{tab}') with gr.Group() as tab_denoise: - strength = gr.Slider(minimum=0, maximum=1, step=0.01, value = 0.9,label='Denoising Strength for Substage',visible=not is_img2img, elem_id=f'strength-{tab}') + strength = gr.Slider(minimum=0, maximum=1, step=0.01, value = 0.85,label='Denoising Strength for Substage',visible=not is_img2img, elem_id=f'strength-{tab}') with gr.Row(variant='compact') as tab_upscale: scale_factor = gr.Slider(minimum=1.0, maximum=8.0, step=1, label='Scale Factor', value=2.0, elem_id=uid('upscaler-factor')) @@ -256,8 +256,6 @@ class Script(scripts.Script): @torch.no_grad() def sample_hijack(self, conditioning, unconditional_conditioning,seeds, subseeds, subseed_strength, prompts,p,image_ori,window_size, overlap, tile_batch_size,random_jitter,c1,c2,c3,strength,sigma): ################################################## Phase Initialization ###################################################### - # p.width = p.width_original_md - # p.height = p.height_original_md if not image_ori: p.current_step = 0 @@ -342,8 +340,6 @@ class Script(scripts.Script): res = torch.concatenate((res,latents_),axis=0) ######################################################################################################################################### - # p.width = p.width*p.scale_factor - # p.height = p.height*p.scale_factor return res diff --git a/tile_methods/demofusion.py b/tile_methods/demofusion.py index 4cdb6cb..cecc26e 100644 --- a/tile_methods/demofusion.py +++ b/tile_methods/demofusion.py @@ -28,8 +28,6 @@ class DemoFusion(AbstractDiffusion): self.sampler: KDiffusionSampler self.sampler.model_wrap_cfg: CFGDenoiserKDiffusion self.sampler.model_wrap_cfg.inner_model: Union[CompVisDenoiser, CompVisVDenoiser] - # sigmas = self.sampler.get_sigmas(self.p, steps) - # self.p.sigmas = sigmas[steps - self.t_enc - 1:] else: self.sampler: CompVisSampler self.sampler.model_wrap_cfg: CFGDenoiserTimesteps @@ -242,8 +240,6 @@ class DemoFusion(AbstractDiffusion): repeat_func = repeat_func_2 N,_,_,_ = x_in.shape - # H = self.h - # W = self.w self.x_buffer = torch.zeros_like(x_in) self.weights = torch.zeros_like(x_in)