eloimoliner / audio-inpainting-diffusion

MIT License
60 stars 9 forks source link

Clip problem #2

Closed MordehayM closed 3 months ago

MordehayM commented 3 months ago

Hi, Thanks for the code. I have tried to run the jupyter notebook but got this issue: Cannot cast ufunc 'clip' output from dtype('float64') to dtype('int64') with casting rule 'same_kind' numpy._core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'clip' output from dtype('float64') to dtype('int64') with casting rule 'same_kind'

During handling of the above exception, another exception occurred:

File "/home/dsi/moradim/audio-inpainting-diffusion/networks/unet_cqt_oct_with_projattention_adaLN_2.py", line 620, in init self.CQTransform=CQT_nsgt(self.args.network.cqt.num_octs, self.args.network.cqt.bins_per_oct, mode="oct",window=win,fs=self.args.exp.sample_rate, audio_len=self.args.exp.audio_len, dtype=torch.float32, device=self.device) File "/home/dsi/moradim/audio-inpainting-diffusion/utils/dnnlib/util.py", line 297, in call_func_by_name return func_obj(*args, **kwargs) File "/home/dsi/moradim/audio-inpainting-diffusion/utils/setup.py", line 49, in setup_network network_obj=dnnlib.call_func_by_name(func_name=args.network.callable, args=args, device=device) File "/home/dsi/moradim/audio-inpainting-diffusion/demo_inpainting_spectrogram.py", line 42, in network=setup.setup_network(args, device) numpy._core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'clip' output from dtype('float64') to dtype('int64') with casting rule 'same_kind

I do not know the source of this issue but I suspect it relates to different versions of the packages. So can you please upload the requirement file to be consistent with you?

To be more specific, the issue was raised from CQT_nsgt, for example for the following code I got the error:

from cqt_nsgt_pytorch import CQT_nsgt import torch

num_octs = 8 bins_per_oct = 64 sample_rate = 44100 win = ('kaiser', 1) audio_len = 184184 device = torch.device("cuda" if torch.cuda.is_available() else "cpu") CQTransform = CQT_nsgt(num_octs, bins_per_oct, mode="oct",window=win,fs=sample_rate, audio_len=audio_len, dtype=torch.float32, device=device)

Thanks