crowsonkb / v-diffusion-pytorch

v objective diffusion inference code for PyTorch.
MIT License
715 stars 108 forks source link

AttributeError: module 'torch' has no attribute 'special' #5

Closed tempdeltavalue closed 2 years ago

tempdeltavalue commented 2 years ago

torch version: 1.8.1+cu111

python ./cfg_sample.py "the rise of consciousness":5 -n 4 -bs 4 --seed 0 Using device: cuda:0 Traceback (most recent call last): File "./cfg_sample.py", line 154, in main() File "./cfg_sample.py", line 148, in main run_all(args.n, args.batch_size) File "./cfg_sample.py", line 136, in run_all steps = utils.get_spliced_ddpm_cosine_schedule(t) File "C:\Users\m\Desktop\v-diffusion-pytorch\diffusion\utils.py", line 75, in get_spliced_ddpm_cosine_schedule ddpm_part = get_ddpm_schedule(big_t + ddpm_crossover - cosine_crossover) File "C:\Users\m\Desktop\v-diffusion-pytorch\diffusion\utils.py", line 65, in get_ddpm_schedule log_snr = -torch.special.expm1(1e-4 + 10 * ddpm_t**2).log() AttributeError: module 'torch' has no attribute 'special'

crowsonkb commented 2 years ago

You need to upgrade your PyTorch version, torch.special was added in 1.9. (Or maybe you can change it to torch.expm1(), that might be the old location).

Norod commented 2 years ago

Arrived here by googling this issue and I just wanted to add that changing it from 'torch.special.expm1' to 'torch.expm1' worked for PyTorch 1.8.1. So thank you!