mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-23 06:36:58 +08:00
Better fix for the Transformer warning
Explicitly set the value of patch_model_to to the intended torch device obtained from get_torch_device. This fixes the Transformer warning. Currently, it takes the current device of the model, which is cpu as the model is loaded in to cpu by deault.
This commit is contained in:
parent
4b1ed67327
commit
d3eaae7f54
@ -286,7 +286,7 @@ class LoadedModel:
|
|||||||
return self.model_memory()
|
return self.model_memory()
|
||||||
|
|
||||||
def model_load(self, lowvram_model_memory=0):
|
def model_load(self, lowvram_model_memory=0):
|
||||||
patch_model_to = self.device
|
patch_model_to = get_torch_device()
|
||||||
|
|
||||||
self.model.model_patches_to(self.device)
|
self.model.model_patches_to(self.device)
|
||||||
self.model.model_patches_to(self.model.model_dtype())
|
self.model.model_patches_to(self.model.model_dtype())
|
||||||
@ -304,7 +304,7 @@ class LoadedModel:
|
|||||||
raise e
|
raise e
|
||||||
|
|
||||||
if is_intel_xpu() and not args.disable_ipex_optimize:
|
if is_intel_xpu() and not args.disable_ipex_optimize:
|
||||||
self.real_model = torch.xpu.optimize(self.real_model.to("xpu").eval(), inplace=True, auto_kernel_selection=True, graph_mode=True)
|
self.real_model = torch.xpu.optimize(self.real_model.eval(), inplace=True, auto_kernel_selection=True, graph_mode=True)
|
||||||
|
|
||||||
self.weights_loaded = True
|
self.weights_loaded = True
|
||||||
return self.real_model
|
return self.real_model
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user