Skip to content

Commit

Permalink
new: Provide userwarning when specifying providers and cuda (#425)
Browse files Browse the repository at this point in the history
* new: Provide userwarning when specifying providers and cuda

* Updated warning message
  • Loading branch information
hh-space-invader authored Dec 24, 2024
1 parent 55b985c commit cec8d54
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fastembed/common/onnx_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit cec8d54

Please sign in to comment.