From f493ab88953102d40a7b176d5f9ebe82102e2287 Mon Sep 17 00:00:00 2001 From: Seunghoon Lee Date: Thu, 1 Feb 2024 02:27:24 +0900 Subject: [PATCH] onnx cpu-only torch fix --- modules/onnx_impl/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/onnx_impl/utils.py b/modules/onnx_impl/utils.py index 3e441efe1..f0dde5a59 100644 --- a/modules/onnx_impl/utils.py +++ b/modules/onnx_impl/utils.py @@ -19,6 +19,11 @@ def extract_device(args: List, kwargs: Dict): def move_inference_session(session: ort.InferenceSession, device: torch.device): + from modules.devices import device as default_device + + if default_device.type == "cpu": # CPU-only torch without any other external ops overriding. This transfer will be led to mistake. + return session + from . import DynamicSessionOptions, TemporalModule from .execution_providers import TORCH_DEVICE_TO_EP