diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2024-01-01 13:39:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-01 13:39:51 +0000 |
commit | dfd64382211317cc46ad337c373492bfc420fa18 (patch) | |
tree | 3b1b2f5f3648da07430f54d1c155ce379a6fa3f7 /modules/sd_samplers_timesteps_impl.py | |
parent | 3d15e58b0a30f2ef1e731f9e429f4d3cf1c259c5 (diff) | |
parent | 0ce67cb61806cf43f4d726d4705a4f6fdc2540e6 (diff) | |
download | stable-diffusion-webui-gfx803-dfd64382211317cc46ad337c373492bfc420fa18.tar.gz stable-diffusion-webui-gfx803-dfd64382211317cc46ad337c373492bfc420fa18.tar.bz2 stable-diffusion-webui-gfx803-dfd64382211317cc46ad337c373492bfc420fa18.zip |
Merge branch 'dev' into feat/interrupted-end
Diffstat (limited to 'modules/sd_samplers_timesteps_impl.py')
-rw-r--r-- | modules/sd_samplers_timesteps_impl.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/sd_samplers_timesteps_impl.py b/modules/sd_samplers_timesteps_impl.py index a72daafd..930a64af 100644 --- a/modules/sd_samplers_timesteps_impl.py +++ b/modules/sd_samplers_timesteps_impl.py @@ -11,7 +11,7 @@ from modules.models.diffusion.uni_pc import uni_pc def ddim(model, x, timesteps, extra_args=None, callback=None, disable=None, eta=0.0):
alphas_cumprod = model.inner_model.inner_model.alphas_cumprod
alphas = alphas_cumprod[timesteps]
- alphas_prev = alphas_cumprod[torch.nn.functional.pad(timesteps[:-1], pad=(1, 0))].to(torch.float64 if x.device.type != 'mps' else torch.float32)
+ alphas_prev = alphas_cumprod[torch.nn.functional.pad(timesteps[:-1], pad=(1, 0))].to(torch.float64 if x.device.type != 'mps' and x.device.type != 'xpu' else torch.float32)
sqrt_one_minus_alphas = torch.sqrt(1 - alphas)
sigmas = eta * np.sqrt((1 - alphas_prev.cpu().numpy()) / (1 - alphas.cpu()) * (1 - alphas.cpu() / alphas_prev.cpu().numpy()))
@@ -43,7 +43,7 @@ def ddim(model, x, timesteps, extra_args=None, callback=None, disable=None, eta= def plms(model, x, timesteps, extra_args=None, callback=None, disable=None):
alphas_cumprod = model.inner_model.inner_model.alphas_cumprod
alphas = alphas_cumprod[timesteps]
- alphas_prev = alphas_cumprod[torch.nn.functional.pad(timesteps[:-1], pad=(1, 0))].to(torch.float64 if x.device.type != 'mps' else torch.float32)
+ alphas_prev = alphas_cumprod[torch.nn.functional.pad(timesteps[:-1], pad=(1, 0))].to(torch.float64 if x.device.type != 'mps' and x.device.type != 'xpu' else torch.float32)
sqrt_one_minus_alphas = torch.sqrt(1 - alphas)
extra_args = {} if extra_args is None else extra_args
|