mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
Compile with IPEX Optimize
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user