kousw / stable-diffusion-webui-daam

DAAM for Stable Diffusion Web UI
Other
163 stars 28 forks source link

Cannot cast ufunc 'divide' output from dtype('float64') to dtype('int64') with casting rule 'same_kind' #7

Open system1system2 opened 1 year ago

system1system2 commented 1 year ago

I'm trying this extension for the latest A1111 commit on a MBP M1 with SD2 768 model. Accordingly, the following flags are used to start the system: --skip-torch-cuda-test --no-half --use-cpu interrogate

torch==1.12.1 torchvision==0.13.1

Everything works fine in the system, but the heatmap doesn't get generated. A1111 returns the following error:

numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'divide' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'

kousw commented 1 year ago

I don't have an M1 Mac, so I don't know the details. But it worked on CPU. Do you know where the error is in more detail?

system1system2 commented 1 year ago

This is the full output:

File "/Users/UserName/Desktop/stable-diffusion-webui/modules/script_callbacks.py", line 121, in before_image_saved_callback c.callback(params) File "/Users/UserName/Desktop/stable-diffusion-webui/extensions/stable-diffusion-webui-daam/scripts/daam_script.py", line 207, in handle_before_image_saved before_image_saved_handler(params) File "/Users/UserName/Desktop/stable-diffusion-webui/extensions/stable-diffusion-webui-daam/scripts/daam_script.py", line 108, in before_image_saved_handler = lambda params : self.before_image_saved(params) File "/Users/UserName/Desktop/stable-diffusion-webui/extensions/stable-diffusion-webui-daam/scripts/daam_script.py", line 162, in before_image_saved global_heat_map = self.tracer.compute_global_heat_map(styled_prompot, batch_pos) File "/Users/UserName/Desktop/stable-diffusion-webui/extensions/stable-diffusion-webui-daam/scripts/daam/trace.py", line 142, in compute_global_heat_map time_weights = [1.0] * len(self.forward_hook.all_heat_maps) numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'divide' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'

This article talks about the error: https://techoverflow.net/2019/05/22/how-to-fix-numpy-typeerror-cannot-cast-ufunc-subtract-output-from-dtypefloat64-to-dtypeint64-with-casting-rule-same_kind/