Fix for the Transformer optimization warning

Fix for the following warning: "UserWarning: Transformer opitmization is only support on XPU now."
This commit is contained in:
BVH 2024-04-15 10:56:19 +05:30 committed by GitHub
parent 719fb2c81d
commit 4b1ed67327
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -304,7 +304,7 @@ class LoadedModel:
raise e
if is_intel_xpu() and not args.disable_ipex_optimize:
self.real_model = torch.xpu.optimize(self.real_model.eval(), inplace=True, auto_kernel_selection=True, graph_mode=True)
self.real_model = torch.xpu.optimize(self.real_model.to("xpu").eval(), inplace=True, auto_kernel_selection=True, graph_mode=True)
self.weights_loaded = True
return self.real_model