diff options
author | Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> | 2023-12-03 02:54:54 +0000 |
---|---|---|
committer | Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> | 2023-12-03 02:54:54 +0000 |
commit | 9a15ae2a92e55d614fe515cd0a104d90b854b23f (patch) | |
tree | 7977ea1ea27cfc1d21e652433f8bbc0faec0ddc9 /modules/sd_samplers_timesteps_impl.py | |
parent | 50a21cb09fe3e9ea2d4fe058e0484e192c8a86e3 (diff) | |
parent | ac02216e540cd581f9169c6c791e55721e3117b0 (diff) | |
download | stable-diffusion-webui-gfx803-9a15ae2a92e55d614fe515cd0a104d90b854b23f.tar.gz stable-diffusion-webui-gfx803-9a15ae2a92e55d614fe515cd0a104d90b854b23f.tar.bz2 stable-diffusion-webui-gfx803-9a15ae2a92e55d614fe515cd0a104d90b854b23f.zip |
Merge branch 'dev' into test-fp8
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
|