Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# defaults
__pycache__
.ruff_cache
.vscode
/cache.json
/metadata.json
/config.json
Expand Down
3 changes: 3 additions & 0 deletions modules/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ def set_cuda_params():
args[4].to("cpu") if args[4] is not None else args[4],
args[5], args[6], args[7], args[8]).to(get_cuda_device_string()),
lambda *args, **kwargs: args[1].device != torch.device("cpu"))
CondFunc('torchsde._brownian.brownian_interval._randn',
lambda _, size, dtype, device, seed: torch.randn(size, dtype=dtype, device=device, generator=torch.xpu.Generator(device).manual_seed(int(seed))),
lambda _, size, dtype, device, seed: device != torch.device("cpu"))

cpu = torch.device("cpu")
device = device_interrogate = device_gfpgan = device_esrgan = device_codeformer = None
Expand Down
9 changes: 1 addition & 8 deletions modules/sd_samplers_kdiffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,7 @@ def create_noise_sampler(self, x, sigmas, p):
sigma_max = sigmas.max()

current_iter_seeds = p.all_seeds[p.iteration * p.batch_size:(p.iteration + 1) * p.batch_size]
if devices.backend == 'ipex': #Remove this after Intel adds support for torch.Generator()
try:
return BrownianTreeNoiseSampler(x.to("cpu"), sigma_min, sigma_max, seed=current_iter_seeds, transform=lambda x: x.to("cpu"), transform_last=lambda x: x.to(shared.device)) # pylint: disable=E1123
except Exception:
shared.log.error("Please apply this patch to repositories/k-diffusion/k_diffusion/sampling.py: https://github.com/crowsonkb/k-diffusion/pull/68/files")
return None
else:
return BrownianTreeNoiseSampler(x, sigma_min, sigma_max, seed=current_iter_seeds)
return BrownianTreeNoiseSampler(x, sigma_min, sigma_max, seed=current_iter_seeds)

def sample_img2img(self, p, x, noise, conditioning, unconditional_conditioning, steps=None, image_conditioning=None):
steps, t_enc = sd_samplers_common.setup_img2img_steps(p, steps)
Expand Down