From cec8d5450205fb0ae52ace1e85039c2123886de2 Mon Sep 17 00:00:00 2001 From: Hossam Hagag <90828745+hh-space-invader@users.noreply.github.com> Date: Tue, 24 Dec 2024 12:37:58 +0200 Subject: [PATCH] new: Provide userwarning when specifying providers and cuda (#425) * new: Provide userwarning when specifying providers and cuda * Updated warning message --- fastembed/common/onnx_model.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fastembed/common/onnx_model.py b/fastembed/common/onnx_model.py index 6daa444f..9e9376f3 100644 --- a/fastembed/common/onnx_model.py +++ b/fastembed/common/onnx_model.py @@ -52,6 +52,13 @@ def _load_onnx_model( model_path = model_dir / model_file # List of Execution Providers: https://onnxruntime.ai/docs/execution-providers + if cuda and providers is not None: + warnings.warn( + f"`cuda` and `providers` are mutually exclusive parameters, cuda: {cuda}, providers: {providers}", + category=UserWarning, + stacklevel=6, + ) + if providers is not None: onnx_providers = list(providers) elif cuda: