Skip to content

Commit e8ddc6e

Browse files
authored
Merge pull request #1089 from ilikenwf/vladpull1
Add missing check for empty tensor
2 parents 794b23c + 1237782 commit e8ddc6e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

modules/sd_samplers_kdiffusion.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,15 @@ def get_sigmas(self, p, steps):
308308

309309
def create_noise_sampler(self, x, sigmas, p):
310310
from k_diffusion.sampling import BrownianTreeNoiseSampler
311-
sigma_min, sigma_max = sigmas[sigmas > 0].min(), sigmas.max()
311+
312+
positive_sigmas = sigmas[sigmas > 0]
313+
314+
if positive_sigmas.numel() > 0:
315+
sigma_min = positive_sigmas.min(dim=0)[0]
316+
else:
317+
sigma_min = 0
318+
319+
sigma_max = sigmas.max()
312320
current_iter_seeds = p.all_seeds[p.iteration * p.batch_size:(p.iteration + 1) * p.batch_size]
313321
return BrownianTreeNoiseSampler(x, sigma_min, sigma_max, seed=current_iter_seeds)
314322

0 commit comments

Comments
 (0)