Compile with IPEX Optimize

This commit is contained in:
Disty0
2023-06-02 13:04:50 +03:00
parent 561ebc612e
commit d6b3504f4d
2 changed files with 6 additions and 2 deletions
+4 -1
View File
@@ -173,7 +173,10 @@ class StableDiffusionModelHijack:
if m.cond_stage_key == "edit":
sd_hijack_unet.hijack_ddpm_edit()
if opts.cuda_compile and opts.cuda_compile_mode != 'none':
if opts.cuda_compile and opts.cuda_compile_mode == 'ipex':
import logging
shared.log.info("Model compile enabled: Using IPEX Optimize Graph Mode")
elif opts.cuda_compile and opts.cuda_compile_mode != 'none':
try:
import logging
import torch._dynamo as dynamo # pylint: disable=unused-import
+2 -1
View File
@@ -529,7 +529,8 @@ def load_model(checkpoint_info=None, already_loaded_state_dict=None, timer=None)
timer.record("hijack")
sd_model.eval()
if shared.cmd_opts.use_ipex and not (shared.cmd_opts.lowvram or shared.cmd_opts.medvram):
sd_model = torch.xpu.optimize(sd_model, dtype=devices.dtype)
sd_model = torch.xpu.optimize(sd_model, dtype=devices.dtype, auto_kernel_selection=True, optimize_lstm=True,
graph_mode=True if shared.opts.cuda_compile and shared.opts.cuda_compile_mode == 'ipex' else False)
shared.log.info("Applied IPEX Optimize")
model_data.sd_model = sd_model
sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings(force_reload=True) # Reload embeddings after model load as they may or may not fit the model