pull/371/head
Jaylen Lee 2024-03-28 15:08:11 +08:00
parent b629e087a0
commit f0cd2ad381
4 changed files with 34 additions and 19 deletions

View File

@ -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-1and 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.5use default values for the restenable 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)
****

View File

@ -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等常用功能
c1c2c3等参数可以参考demofusion. 你不必调整这些参数
由于实现细节的差异c1c2c3等参数可以参考[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
- 以下为获得的102420483072分辨率的图片
![demo-result](https://github.com/Jaylen-Lee/image-demo/blob/main/3.png?raw=true)
****

View File

@ -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

View File

@ -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)