fix: test_sets_default_sess_options fails if compiling with globally enabled cuda ()

Coming from nixos, this test fails when cuda is enabled. https://github.com/NixOS/nixpkgs/pull/382896

Solution as proposed by @mertalev
This commit is contained in:
Mitchell Pleune 2025-04-10 13:06:33 -04:00 committed by GitHub
parent 7fcab4b251
commit 9fd2c5220d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -278,8 +278,8 @@ class TestOrtSession:
assert session.provider_options == []
def test_sets_default_sess_options(self) -> None:
session = OrtSession("ViT-B-32__openai")
def test_sets_default_sess_options_if_cpu(self) -> None:
session = OrtSession("ViT-B-32__openai", providers=["CPUExecutionProvider"])
assert session.sess_options.execution_mode == ort.ExecutionMode.ORT_SEQUENTIAL
assert session.sess_options.inter_op_num_threads == 1