Move/Remove hijacks. Add warning.

This commit is contained in:
Seunghoon Lee
2023-04-30 11:12:47 +09:00
parent a41cf2bd84
commit e65d74100f
4 changed files with 2 additions and 5 deletions
+1
View File
@@ -2,3 +2,4 @@ import modules.dml.hijack.kdiffusion
import modules.dml.hijack.stablediffusion
import modules.dml.hijack.torch
import modules.dml.hijack.realesrgan_model
import modules.dml.hijack.plms
-3
View File
@@ -257,9 +257,6 @@ class EmbeddingsWithFixes(torch.nn.Module):
for offset, embedding in fixes:
emb = devices.cond_cast_unet(embedding.vec)
emb_len = min(tensor.shape[0] - offset - 1, emb.shape[0])
# DML Solution: type mismatch on half mode
if tensor.dtype == torch.float16 and emb.dtype == torch.float32 and not shared.cmd_opts.no_half:
emb = emb.half()
tensor = torch.cat([tensor[0:offset + 1], emb[0:emb_len], tensor[offset + 1 + emb_len:]])
vecs.append(tensor)
-1
View File
@@ -53,7 +53,6 @@ def p_sample_plms(self, x, c, t, index, repeat_noise=False, use_original_steps=F
def get_x_prev_and_pred_x0(e_t, index):
# select parameters corresponding to the currently considered timestep
print(alphas[index]) # DML Solution: PLMS Sampling does not work without this print.
a_t = torch.full((b, 1, 1, 1), alphas[index], device=device)
a_prev = torch.full((b, 1, 1, 1), alphas_prev[index], device=device)
sigma_t = torch.full((b, 1, 1, 1), sigmas[index], device=device)
+1 -1
View File
@@ -322,7 +322,7 @@ options_templates.update(options_section(('cuda', "CUDA Settings"), {
"memmon_poll_rate": OptionInfo(2, "VRAM usage polls per second during generation. Set to 0 to disable.", gr.Slider, {"minimum": 0, "maximum": 40, "step": 1}),
"precision": OptionInfo("Autocast", "Precision type", gr.Radio, lambda: {"choices": ["Autocast", "Full"]}),
"cuda_dtype": OptionInfo("FP32" if sys.platform == "darwin" else "FP16", "Device precision type", gr.Radio, lambda: {"choices": ["FP32", "FP16", "BF16"]}),
"no_half": OptionInfo(True if is_device_dml else False, "Use full precision for model (--no-half)"),
"no_half": OptionInfo(True if is_device_dml else False, "Use full precision for model (--no-half)", None, None, lambda: print("Warning: Most of DirectML devices do not fully support half mode. Recommend to use full precision to model.") if is_device_dml else None),
"no_half_vae": OptionInfo(True if is_device_dml else False, "Use full precision for VAE (--no-half-vae)"),
"upcast_sampling": OptionInfo(True if sys.platform == "darwin" else False, "Enable upcast sampling. Usually produces similar results to --no-half with better performance while using less memory"),
"disable_nan_check": OptionInfo(True, "Do not check if produced images/latent spaces have NaN values"),