Open benjamin-bertram opened 5 months ago
Forge is a good tool, so I'll consider supporting it. However, although I haven't seen the implementation yet, I've heard that forge includes a mechanism that makes it easy to hook into unet, so I have a feeling that clips alone won't work correctly.
It does not use the sd-hijack-clip, but rather an own fork, this is the line where your script throws me an error (not supported embedder): https://github.com/lllyasviel/stable-diffusion-webui-forge/blob/d81e353d8928147bbd973068d0efbb2802affe0f/modules_forge/forge_clip.py#L16
It works on my end, but I still need to make some changes around attention, and it is no longer compatible with the original webui, so I'm wondering how to update it. I've pushed it to 'forge' branch for now.
Nice, thanks. It throws me an error, But I cannot really see where it comes from:
Traceback (most recent call last):
File "/Users/benjaminbertram/stable-diffusion-webui-forge/modules_forge/main_thread.py", line 37, in loop
task.work()
File "/Users/benjaminbertram/stable-diffusion-webui-forge/modules_forge/main_thread.py", line 26, in work
self.result = self.func(*self.args, self.kwargs)
File "/Users/benjaminbertram/stable-diffusion-webui-forge/modules/txt2img.py", line 111, in txt2img_function
processed = processing.process_images(p)
File "/Users/benjaminbertram/stable-diffusion-webui-forge/modules/processing.py", line 750, in process_images
res = process_images_inner(p)
File "/Users/benjaminbertram/stable-diffusion-webui-forge/modules/processing.py", line 921, in process_images_inner
samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
File "/Users/benjaminbertram/stable-diffusion-webui-forge/modules/processing.py", line 1276, in sample
samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
File "/Users/benjaminbertram/stable-diffusion-webui-forge/modules/sd_samplers_kdiffusion.py", line 251, in sample
samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, extra_params_kwargs))
File "/Users/benjaminbertram/stable-diffusion-webui-forge/modules/sd_samplers_common.py", line 263, in launch_sampling
return func()
File "/Users/benjaminbertram/stable-diffusion-webui-forge/modules/sd_samplers_kdiffusion.py", line 251, in
Probably a problem with Mac M1 to M3. To work around it, I added a heatmap interpolation mode to the forge branch. Default is 'bicublic' but try 'bilinear' or 'conv'.
Here I first got
File "/Users/benjaminbertram/stable-diffusion-webui-forge/extensions/stable-diffusion-webui-daam/scripts/daam_script.py", line 187, in process_batch self.tracers = [trace(p.sd_model, p.height, p.width, context_size, interpolation_method = interpolation_mode)] TypeError: DiffusionHeatMapHooker.__init__() got an unexpected keyword argument 'interpolation_method'
so it thought it might throw an error because of interpolation_method = interpolation_mode
and changed it to just interpolation_mode
. But then I get
File "/Users/benjaminbertram/stable-diffusion-webui-forge/extensions/stable-diffusion-webui-daam/scripts/daam/trace.py", line 236, in _up_sample_attn value = value.permute(1, 0, 2) AttributeError: module 'torch.mps' has no attribute 'amp' module 'torch.mps' has no attribute 'amp'
I thus uncomment with torch.cuda.amp.autocast(dtype=torch.float32):
but i still have the same error. I cannot trace where is another amp
attribute in the code :/
It probably is something with M1 but before i switched to forge the script worked for me.
Tried the forge branch and I get this error:
TypeError: UNetCrossAttentionHooker._forward() got an unexpected keyword argument 'value' UNetCrossAttentionHooker._forward() got an unexpected keyword argument 'value'
I also don't see any option for the interpolation mode.
Also, there's no enable button. So I have to manually disable the extension.
I removed unnecessary amp codes on forge branch. I don't have an 'mps' environment so I can't test it, but normal operation is fine.
Don't forget to 'Apply and restart UI' when you update the code!
Can confirm the forge branch works on A1111-1.8-Forge after doing a git checkout forge
in the daam extension folder.
Don't forget to 'Apply and restart UI' when you update the code!
That didn't work for me after the branch checkout, had to restart the whole application.
The forge
branch also works perfectly for me in the latest Forge build. I'm on Windows/Nvidia.
Thank you, this is a fantastic tool.
Forge works with forge_clip.CLIP_SD_15_L instead of sd_hijack_clip.FrozenCLIPEmbedderWithCustomWords; I tried to rewrite it, but I do not know quite understand of forge_clip.CLIP_SD15 works to really make it work. I just get errors all the time. As you also implemented SDXL support, you might have a better understanding of forge_clip.CLIP_SD15 - I tried to reproduce your commits on SDXL with forge but to no avail.