mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-28 19:06:52 +03:00
CI / AMD64 Build (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
The CUDA execution provider returns an identical vector for every image when jina-clip-v2 is built below ORT_ENABLE_EXTENDED, so every thumbnail embedding written on a GPU was the same normalized garbage and semantic search returned the same results for any query. Reproduced on two different NVIDIA cards, across onnxruntime 1.22 and 1.24, and on both the 0.17 and 0.18 CUDA stacks, so it isn't specific to any of those. ORT_ENABLE_ALL isn't an option because it fails to build on CPU with a SimplifiedLayerNormFusion error, leaving EXTENDED as the only level that works on both providers. jinav1 is unaffected and stays on BASIC.
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
"""Tests for ONNX Runtime session option selection."""
|
|
|
|
import unittest
|
|
|
|
import onnxruntime as ort
|
|
|
|
from frigate.detectors.detection_runners import get_ort_session_options
|
|
from frigate.detectors.detector_config import ModelTypeEnum
|
|
from frigate.embeddings.types import EnrichmentModelTypeEnum
|
|
|
|
|
|
class TestGetOrtSessionOptions(unittest.TestCase):
|
|
def test_jina_v2_uses_extended(self):
|
|
"""jina-clip-v2 returns an identical vector for every image on the CUDA
|
|
execution provider at anything below EXTENDED."""
|
|
options = get_ort_session_options(EnrichmentModelTypeEnum.jina_v2.value)
|
|
|
|
self.assertIsNotNone(options)
|
|
self.assertEqual(
|
|
options.graph_optimization_level,
|
|
ort.GraphOptimizationLevel.ORT_ENABLE_EXTENDED,
|
|
)
|
|
|
|
def test_jina_v1_uses_basic(self):
|
|
options = get_ort_session_options(EnrichmentModelTypeEnum.jina_v1.value)
|
|
|
|
self.assertIsNotNone(options)
|
|
self.assertEqual(
|
|
options.graph_optimization_level,
|
|
ort.GraphOptimizationLevel.ORT_ENABLE_BASIC,
|
|
)
|
|
|
|
def test_other_models_use_defaults(self):
|
|
for model_type in [
|
|
None,
|
|
EnrichmentModelTypeEnum.paddleocr.value,
|
|
EnrichmentModelTypeEnum.arcface.value,
|
|
ModelTypeEnum.rfdetr.value,
|
|
]:
|
|
with self.subTest(model_type=model_type):
|
|
self.assertIsNone(get_ort_session_options(model_type))
|