feat(ml): improve model loading (#31742)

* use recent mimalloc

* jit caching

* bump onnxruntime-gpu

* explicit memory release

* refactor in-memory cache

* configure hf org and revision

* refactor model load

* move orjson response

* disable direct submission for i915

* flush denormals

* update tests and lock

* disable suboptimal fusions

* respect resize_mode

* increase threads for clip text
This commit is contained in:
Mert
2026-09-25 14:56:43 -04:00
committed by GitHub
parent 87e76d8912
commit de13aab713
17 changed files with 470 additions and 264 deletions
+6 -2
View File
@@ -9,6 +9,7 @@ from PIL import Image
from immich_ml.config import log
from immich_ml.main import app
from immich_ml.models.base import InferenceModel
@pytest.fixture
@@ -18,7 +19,7 @@ def pil_image() -> Image.Image:
@pytest.fixture
def mock_get_model() -> Iterator[mock.Mock]:
with mock.patch("immich_ml.models.cache.from_model_type", autospec=True) as mocked:
with mock.patch("immich_ml.models.cache.get_model_class") as mocked:
yield mocked
@@ -187,5 +188,8 @@ def exception() -> Iterator[mock.Mock]:
@pytest.fixture(scope="function")
def snapshot_download() -> Iterator[mock.Mock]:
with mock.patch("immich_ml.models.base.snapshot_download") as mocked:
with (
mock.patch("immich_ml.models.base.snapshot_download") as mocked,
mock.patch.object(InferenceModel, "cached", new_callable=mock.PropertyMock, side_effect=lambda: mocked.called),
):
yield mocked