MCPcopy
hub / github.com/kohya-ss/sd-scripts / init_ipex

Function init_ipex

library/device_utils.py:90–108  ·  view source on GitHub ↗

Apply IPEX to CUDA hijacks using `library.ipex.ipex_init`. This function should run right after importing torch and before doing anything else. If xpu is not available, this function does nothing.

()

Source from the content-addressed store, hash-verified

88
89
90def init_ipex():
91 """
92 Apply IPEX to CUDA hijacks using `library.ipex.ipex_init`.
93
94 This function should run right after importing torch and before doing anything else.
95
96 If xpu is not available, this function does nothing.
97 """
98 try:
99 if HAS_XPU:
100 from library.ipex import ipex_init
101
102 is_initialized, error_message = ipex_init()
103 if not is_initialized:
104 print("failed to initialize ipex:", error_message)
105 else:
106 return
107 except Exception as e:
108 print("failed to initialize ipex:", e)

Callers 15

train_db.pyFile · 0.90
sd3_train.pyFile · 0.90
train_leco.pyFile · 0.90
flux_train.pyFile · 0.90
lumina_train.pyFile · 0.90
anima_train.pyFile · 0.90
sdxl_train_leco.pyFile · 0.90
gen_img.pyFile · 0.90

Calls 1

ipex_initFunction · 0.90

Tested by

no test coverage detected