forked from Cutlery/immich
		
	Merge branch 'main' of https://github.com/immich-app/immich into feat/offline-files-job
This commit is contained in:
		
						commit
						f2017730a1
					
				
							
								
								
									
										85
									
								
								e2e/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										85
									
								
								e2e/package-lock.json
									
									
									
										generated
									
									
									
								
							@ -70,6 +70,7 @@
 | 
				
			|||||||
        "prettier-plugin-organize-imports": "^3.2.4",
 | 
					        "prettier-plugin-organize-imports": "^3.2.4",
 | 
				
			||||||
        "typescript": "^5.3.3",
 | 
					        "typescript": "^5.3.3",
 | 
				
			||||||
        "vite": "^5.0.12",
 | 
					        "vite": "^5.0.12",
 | 
				
			||||||
 | 
					        "vite-tsconfig-paths": "^4.3.2",
 | 
				
			||||||
        "vitest": "^1.2.2",
 | 
					        "vitest": "^1.2.2",
 | 
				
			||||||
        "yaml": "^2.3.1"
 | 
					        "yaml": "^2.3.1"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
@ -1276,16 +1277,16 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@typescript-eslint/eslint-plugin": {
 | 
					    "node_modules/@typescript-eslint/eslint-plugin": {
 | 
				
			||||||
      "version": "7.1.1",
 | 
					      "version": "7.2.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.1.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.2.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-zioDz623d0RHNhvx0eesUmGfIjzrk18nSBC8xewepKXbBvN/7c1qImV7Hg8TI1URTxKax7/zxfxj3Uph8Chcuw==",
 | 
					      "integrity": "sha512-mdekAHOqS9UjlmyF/LSs6AIEvfceV749GFxoBAjwAv0nkevfKHWQFDMcBZWUiIC5ft6ePWivXoS36aKQ0Cy3sw==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "@eslint-community/regexpp": "^4.5.1",
 | 
					        "@eslint-community/regexpp": "^4.5.1",
 | 
				
			||||||
        "@typescript-eslint/scope-manager": "7.1.1",
 | 
					        "@typescript-eslint/scope-manager": "7.2.0",
 | 
				
			||||||
        "@typescript-eslint/type-utils": "7.1.1",
 | 
					        "@typescript-eslint/type-utils": "7.2.0",
 | 
				
			||||||
        "@typescript-eslint/utils": "7.1.1",
 | 
					        "@typescript-eslint/utils": "7.2.0",
 | 
				
			||||||
        "@typescript-eslint/visitor-keys": "7.1.1",
 | 
					        "@typescript-eslint/visitor-keys": "7.2.0",
 | 
				
			||||||
        "debug": "^4.3.4",
 | 
					        "debug": "^4.3.4",
 | 
				
			||||||
        "graphemer": "^1.4.0",
 | 
					        "graphemer": "^1.4.0",
 | 
				
			||||||
        "ignore": "^5.2.4",
 | 
					        "ignore": "^5.2.4",
 | 
				
			||||||
@ -1311,15 +1312,15 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@typescript-eslint/parser": {
 | 
					    "node_modules/@typescript-eslint/parser": {
 | 
				
			||||||
      "version": "7.1.1",
 | 
					      "version": "7.2.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.1.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.2.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-ZWUFyL0z04R1nAEgr9e79YtV5LbafdOtN7yapNbn1ansMyaegl2D4bL7vHoJ4HPSc4CaLwuCVas8CVuneKzplQ==",
 | 
					      "integrity": "sha512-5FKsVcHTk6TafQKQbuIVkXq58Fnbkd2wDL4LB7AURN7RUOu1utVP+G8+6u3ZhEroW3DF6hyo3ZEXxgKgp4KeCg==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "@typescript-eslint/scope-manager": "7.1.1",
 | 
					        "@typescript-eslint/scope-manager": "7.2.0",
 | 
				
			||||||
        "@typescript-eslint/types": "7.1.1",
 | 
					        "@typescript-eslint/types": "7.2.0",
 | 
				
			||||||
        "@typescript-eslint/typescript-estree": "7.1.1",
 | 
					        "@typescript-eslint/typescript-estree": "7.2.0",
 | 
				
			||||||
        "@typescript-eslint/visitor-keys": "7.1.1",
 | 
					        "@typescript-eslint/visitor-keys": "7.2.0",
 | 
				
			||||||
        "debug": "^4.3.4"
 | 
					        "debug": "^4.3.4"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "engines": {
 | 
					      "engines": {
 | 
				
			||||||
@ -1339,13 +1340,13 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@typescript-eslint/scope-manager": {
 | 
					    "node_modules/@typescript-eslint/scope-manager": {
 | 
				
			||||||
      "version": "7.1.1",
 | 
					      "version": "7.2.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.2.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-cirZpA8bJMRb4WZ+rO6+mnOJrGFDd38WoXCEI57+CYBqta8Yc8aJym2i7vyqLL1vVYljgw0X27axkUXz32T8TA==",
 | 
					      "integrity": "sha512-Qh976RbQM/fYtjx9hs4XkayYujB/aPwglw2choHmf3zBjB4qOywWSdt9+KLRdHubGcoSwBnXUH2sR3hkyaERRg==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "@typescript-eslint/types": "7.1.1",
 | 
					        "@typescript-eslint/types": "7.2.0",
 | 
				
			||||||
        "@typescript-eslint/visitor-keys": "7.1.1"
 | 
					        "@typescript-eslint/visitor-keys": "7.2.0"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "engines": {
 | 
					      "engines": {
 | 
				
			||||||
        "node": "^16.0.0 || >=18.0.0"
 | 
					        "node": "^16.0.0 || >=18.0.0"
 | 
				
			||||||
@ -1356,13 +1357,13 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@typescript-eslint/type-utils": {
 | 
					    "node_modules/@typescript-eslint/type-utils": {
 | 
				
			||||||
      "version": "7.1.1",
 | 
					      "version": "7.2.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.1.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.2.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-5r4RKze6XHEEhlZnJtR3GYeCh1IueUHdbrukV2KSlLXaTjuSfeVF8mZUVPLovidCuZfbVjfhi4c0DNSa/Rdg5g==",
 | 
					      "integrity": "sha512-xHi51adBHo9O9330J8GQYQwrKBqbIPJGZZVQTHHmy200hvkLZFWJIFtAG/7IYTWUyun6DE6w5InDReePJYJlJA==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "@typescript-eslint/typescript-estree": "7.1.1",
 | 
					        "@typescript-eslint/typescript-estree": "7.2.0",
 | 
				
			||||||
        "@typescript-eslint/utils": "7.1.1",
 | 
					        "@typescript-eslint/utils": "7.2.0",
 | 
				
			||||||
        "debug": "^4.3.4",
 | 
					        "debug": "^4.3.4",
 | 
				
			||||||
        "ts-api-utils": "^1.0.1"
 | 
					        "ts-api-utils": "^1.0.1"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
@ -1383,9 +1384,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@typescript-eslint/types": {
 | 
					    "node_modules/@typescript-eslint/types": {
 | 
				
			||||||
      "version": "7.1.1",
 | 
					      "version": "7.2.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.2.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-KhewzrlRMrgeKm1U9bh2z5aoL4s7K3tK5DwHDn8MHv0yQfWFz/0ZR6trrIHHa5CsF83j/GgHqzdbzCXJ3crx0Q==",
 | 
					      "integrity": "sha512-XFtUHPI/abFhm4cbCDc5Ykc8npOKBSJePY3a3s+lwumt7XWJuzP5cZcfZ610MIPHjQjNsOLlYK8ASPaNG8UiyA==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "engines": {
 | 
					      "engines": {
 | 
				
			||||||
        "node": "^16.0.0 || >=18.0.0"
 | 
					        "node": "^16.0.0 || >=18.0.0"
 | 
				
			||||||
@ -1396,13 +1397,13 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@typescript-eslint/typescript-estree": {
 | 
					    "node_modules/@typescript-eslint/typescript-estree": {
 | 
				
			||||||
      "version": "7.1.1",
 | 
					      "version": "7.2.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.2.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-9ZOncVSfr+sMXVxxca2OJOPagRwT0u/UHikM2Rd6L/aB+kL/QAuTnsv6MeXtjzCJYb8PzrXarypSGIPx3Jemxw==",
 | 
					      "integrity": "sha512-cyxS5WQQCoBwSakpMrvMXuMDEbhOo9bNHHrNcEWis6XHx6KF518tkF1wBvKIn/tpq5ZpUYK7Bdklu8qY0MsFIA==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "@typescript-eslint/types": "7.1.1",
 | 
					        "@typescript-eslint/types": "7.2.0",
 | 
				
			||||||
        "@typescript-eslint/visitor-keys": "7.1.1",
 | 
					        "@typescript-eslint/visitor-keys": "7.2.0",
 | 
				
			||||||
        "debug": "^4.3.4",
 | 
					        "debug": "^4.3.4",
 | 
				
			||||||
        "globby": "^11.1.0",
 | 
					        "globby": "^11.1.0",
 | 
				
			||||||
        "is-glob": "^4.0.3",
 | 
					        "is-glob": "^4.0.3",
 | 
				
			||||||
@ -1448,17 +1449,17 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@typescript-eslint/utils": {
 | 
					    "node_modules/@typescript-eslint/utils": {
 | 
				
			||||||
      "version": "7.1.1",
 | 
					      "version": "7.2.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.1.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.2.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-thOXM89xA03xAE0lW7alstvnyoBUbBX38YtY+zAUcpRPcq9EIhXPuJ0YTv948MbzmKh6e1AUszn5cBFK49Umqg==",
 | 
					      "integrity": "sha512-YfHpnMAGb1Eekpm3XRK8hcMwGLGsnT6L+7b2XyRv6ouDuJU1tZir1GS2i0+VXRatMwSI1/UfcyPe53ADkU+IuA==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "@eslint-community/eslint-utils": "^4.4.0",
 | 
					        "@eslint-community/eslint-utils": "^4.4.0",
 | 
				
			||||||
        "@types/json-schema": "^7.0.12",
 | 
					        "@types/json-schema": "^7.0.12",
 | 
				
			||||||
        "@types/semver": "^7.5.0",
 | 
					        "@types/semver": "^7.5.0",
 | 
				
			||||||
        "@typescript-eslint/scope-manager": "7.1.1",
 | 
					        "@typescript-eslint/scope-manager": "7.2.0",
 | 
				
			||||||
        "@typescript-eslint/types": "7.1.1",
 | 
					        "@typescript-eslint/types": "7.2.0",
 | 
				
			||||||
        "@typescript-eslint/typescript-estree": "7.1.1",
 | 
					        "@typescript-eslint/typescript-estree": "7.2.0",
 | 
				
			||||||
        "semver": "^7.5.4"
 | 
					        "semver": "^7.5.4"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "engines": {
 | 
					      "engines": {
 | 
				
			||||||
@ -1473,12 +1474,12 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@typescript-eslint/visitor-keys": {
 | 
					    "node_modules/@typescript-eslint/visitor-keys": {
 | 
				
			||||||
      "version": "7.1.1",
 | 
					      "version": "7.2.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.2.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-yTdHDQxY7cSoCcAtiBzVzxleJhkGB9NncSIyMYe2+OGON1ZsP9zOPws/Pqgopa65jvknOjlk/w7ulPlZ78PiLQ==",
 | 
					      "integrity": "sha512-c6EIQRHhcpl6+tO8EMR+kjkkV+ugUNXOmeASA1rlzkd8EPIriavpWoiEz1HR/VLhbVIdhqnV6E7JZm00cBDx2A==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "@typescript-eslint/types": "7.1.1",
 | 
					        "@typescript-eslint/types": "7.2.0",
 | 
				
			||||||
        "eslint-visitor-keys": "^3.4.1"
 | 
					        "eslint-visitor-keys": "^3.4.1"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "engines": {
 | 
					      "engines": {
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@ ARG DEVICE=cpu
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
FROM python:3.11-bookworm@sha256:991e20a11120277e977cadbc104e7a9b196a68a346597879821b19034285a403 as builder-cpu
 | 
					FROM python:3.11-bookworm@sha256:991e20a11120277e977cadbc104e7a9b196a68a346597879821b19034285a403 as builder-cpu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM openvino/ubuntu22_runtime:2023.1.0@sha256:002842a9005ba01543b7169ff6f14ecbec82287f09c4d1dd37717f0a8e8754a7 as builder-openvino
 | 
					FROM openvino/ubuntu22_runtime:2023.3.0@sha256:176646df619032ea6c10faf842867119c393e7497b7f88b5e307e932a0fd5aa8 as builder-openvino
 | 
				
			||||||
USER root
 | 
					USER root
 | 
				
			||||||
RUN apt-get update && apt-get install -y --no-install-recommends python3-dev
 | 
					RUN apt-get update && apt-get install -y --no-install-recommends python3-dev
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -26,6 +26,8 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
 | 
				
			|||||||
    VIRTUAL_ENV="/opt/venv" \
 | 
					    VIRTUAL_ENV="/opt/venv" \
 | 
				
			||||||
    PATH="/opt/venv/bin:${PATH}"
 | 
					    PATH="/opt/venv/bin:${PATH}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN apt-get update && apt-get install -y --no-install-recommends g++
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN pip install --upgrade pip && pip install poetry
 | 
					RUN pip install --upgrade pip && pip install poetry
 | 
				
			||||||
RUN poetry config installer.max-workers 10 && \
 | 
					RUN poetry config installer.max-workers 10 && \
 | 
				
			||||||
    poetry config virtualenvs.create false
 | 
					    poetry config virtualenvs.create false
 | 
				
			||||||
@ -36,7 +38,7 @@ RUN poetry install --sync --no-interaction --no-ansi --no-root --with ${DEVICE}
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
FROM python:3.11-slim-bookworm@sha256:a2eb07f336e4f194358382611b4fea136c632b40baa6314cb27a366deeaf0144 as prod-cpu
 | 
					FROM python:3.11-slim-bookworm@sha256:a2eb07f336e4f194358382611b4fea136c632b40baa6314cb27a366deeaf0144 as prod-cpu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM openvino/ubuntu22_runtime:2023.1.0@sha256:002842a9005ba01543b7169ff6f14ecbec82287f09c4d1dd37717f0a8e8754a7 as prod-openvino
 | 
					FROM openvino/ubuntu22_runtime:2023.3.0@sha256:176646df619032ea6c10faf842867119c393e7497b7f88b5e307e932a0fd5aa8 as prod-openvino
 | 
				
			||||||
USER root
 | 
					USER root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04@sha256:2d913b09e6be8387e1a10976933642c73c840c0b735f0bf3c28d97fc9bc422e0 as prod-cuda
 | 
					FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04@sha256:2d913b09e6be8387e1a10976933642c73c840c0b735f0bf3c28d97fc9bc422e0 as prod-cuda
 | 
				
			||||||
@ -77,7 +79,8 @@ ENV NODE_ENV=production \
 | 
				
			|||||||
    PYTHONDONTWRITEBYTECODE=1 \
 | 
					    PYTHONDONTWRITEBYTECODE=1 \
 | 
				
			||||||
    PYTHONUNBUFFERED=1 \
 | 
					    PYTHONUNBUFFERED=1 \
 | 
				
			||||||
    PATH="/opt/venv/bin:$PATH" \
 | 
					    PATH="/opt/venv/bin:$PATH" \
 | 
				
			||||||
  PYTHONPATH=/usr/src
 | 
					    PYTHONPATH=/usr/src \
 | 
				
			||||||
 | 
					    DEVICE=${DEVICE}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# prevent core dumps
 | 
					# prevent core dumps
 | 
				
			||||||
RUN echo "hard core 0" >> /etc/security/limits.conf && \
 | 
					RUN echo "hard core 0" >> /etc/security/limits.conf && \
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
from __future__ import annotations
 | 
					from __future__ import annotations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import os
 | 
					 | 
				
			||||||
from abc import ABC, abstractmethod
 | 
					from abc import ABC, abstractmethod
 | 
				
			||||||
from pathlib import Path
 | 
					from pathlib import Path
 | 
				
			||||||
from shutil import rmtree
 | 
					from shutil import rmtree
 | 
				
			||||||
@ -115,17 +114,12 @@ class InferenceModel(ABC):
 | 
				
			|||||||
            case ".armnn":
 | 
					            case ".armnn":
 | 
				
			||||||
                session = AnnSession(model_path)
 | 
					                session = AnnSession(model_path)
 | 
				
			||||||
            case ".onnx":
 | 
					            case ".onnx":
 | 
				
			||||||
                cwd = os.getcwd()
 | 
					 | 
				
			||||||
                try:
 | 
					 | 
				
			||||||
                    os.chdir(model_path.parent)
 | 
					 | 
				
			||||||
                session = ort.InferenceSession(
 | 
					                session = ort.InferenceSession(
 | 
				
			||||||
                    model_path.as_posix(),
 | 
					                    model_path.as_posix(),
 | 
				
			||||||
                    sess_options=self.sess_options,
 | 
					                    sess_options=self.sess_options,
 | 
				
			||||||
                    providers=self.providers,
 | 
					                    providers=self.providers,
 | 
				
			||||||
                    provider_options=self.provider_options,
 | 
					                    provider_options=self.provider_options,
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
                finally:
 | 
					 | 
				
			||||||
                    os.chdir(cwd)
 | 
					 | 
				
			||||||
            case _:
 | 
					            case _:
 | 
				
			||||||
                raise ValueError(f"Unsupported model file type: {model_path.suffix}")
 | 
					                raise ValueError(f"Unsupported model file type: {model_path.suffix}")
 | 
				
			||||||
        return session
 | 
					        return session
 | 
				
			||||||
 | 
				
			|||||||
@ -262,7 +262,6 @@ class TestBase:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        mock_ann = mocker.patch("app.models.base.AnnSession")
 | 
					        mock_ann = mocker.patch("app.models.base.AnnSession")
 | 
				
			||||||
        mock_ort = mocker.patch("app.models.base.ort.InferenceSession")
 | 
					        mock_ort = mocker.patch("app.models.base.ort.InferenceSession")
 | 
				
			||||||
        mocker.patch("app.models.base.os.chdir")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        encoder = OpenCLIPEncoder("ViT-B-32__openai")
 | 
					        encoder = OpenCLIPEncoder("ViT-B-32__openai")
 | 
				
			||||||
        encoder._make_session(mock_armnn_path)
 | 
					        encoder._make_session(mock_armnn_path)
 | 
				
			||||||
@ -285,26 +284,6 @@ class TestBase:
 | 
				
			|||||||
        mock_ann.assert_not_called()
 | 
					        mock_ann.assert_not_called()
 | 
				
			||||||
        mock_ort.assert_not_called()
 | 
					        mock_ort.assert_not_called()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_make_session_changes_cwd(self, mocker: MockerFixture) -> None:
 | 
					 | 
				
			||||||
        mock_model_path = mocker.Mock()
 | 
					 | 
				
			||||||
        mock_model_path.is_file.return_value = True
 | 
					 | 
				
			||||||
        mock_model_path.suffix = ".onnx"
 | 
					 | 
				
			||||||
        mock_model_path.parent = "model_parent"
 | 
					 | 
				
			||||||
        mock_model_path.with_suffix.return_value = mock_model_path
 | 
					 | 
				
			||||||
        mock_ort = mocker.patch("app.models.base.ort.InferenceSession")
 | 
					 | 
				
			||||||
        mock_chdir = mocker.patch("app.models.base.os.chdir")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        encoder = OpenCLIPEncoder("ViT-B-32__openai")
 | 
					 | 
				
			||||||
        encoder._make_session(mock_model_path)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        mock_chdir.assert_has_calls(
 | 
					 | 
				
			||||||
            [
 | 
					 | 
				
			||||||
                mock.call(mock_model_path.parent),
 | 
					 | 
				
			||||||
                mock.call(os.getcwd()),
 | 
					 | 
				
			||||||
            ]
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
        mock_ort.assert_called_once()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def test_download(self, mocker: MockerFixture) -> None:
 | 
					    def test_download(self, mocker: MockerFixture) -> None:
 | 
				
			||||||
        mock_snapshot_download = mocker.patch("app.models.base.snapshot_download")
 | 
					        mock_snapshot_download = mocker.patch("app.models.base.snapshot_download")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										17
									
								
								machine-learning/poetry.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										17
									
								
								machine-learning/poetry.lock
									
									
									
										generated
									
									
									
								
							@ -1,4 +1,4 @@
 | 
				
			|||||||
# This file is automatically @generated by Poetry 1.8.1 and should not be changed by hand.
 | 
					# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "aiocache"
 | 
					name = "aiocache"
 | 
				
			||||||
@ -2064,21 +2064,22 @@ reference = "cuda12"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "onnxruntime-openvino"
 | 
					name = "onnxruntime-openvino"
 | 
				
			||||||
version = "1.15.0"
 | 
					version = "1.17.1"
 | 
				
			||||||
description = "ONNX Runtime is a runtime accelerator for Machine Learning models"
 | 
					description = "ONNX Runtime is a runtime accelerator for Machine Learning models"
 | 
				
			||||||
optional = false
 | 
					optional = false
 | 
				
			||||||
python-versions = "*"
 | 
					python-versions = "*"
 | 
				
			||||||
files = [
 | 
					files = [
 | 
				
			||||||
    {file = "onnxruntime_openvino-1.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac9bfe245312e897f219dfef619c0d98f4797ffb008ad55aa41aedb32b522f72"},
 | 
					    {file = "onnxruntime_openvino-1.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6ed693011b472f9a617b2d5c4785d5fa1e1b77f7cb2b02e47b899534ec6c6396"},
 | 
				
			||||||
    {file = "onnxruntime_openvino-1.15.0-cp310-cp310-win_amd64.whl", hash = "sha256:a31cd9c9848dc196803d74ea46152fe0f3dd876bc5769eff7e3776fef4c654de"},
 | 
					    {file = "onnxruntime_openvino-1.17.1-cp310-cp310-win_amd64.whl", hash = "sha256:5152b5e56e83e022ced2986700d68dd8ba7b1466761725ce774f679c5710ab87"},
 | 
				
			||||||
    {file = "onnxruntime_openvino-1.15.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0c9bc1614f9d267d62023287035d204d9840ac0057d1c7a770a27acdd1642662"},
 | 
					    {file = "onnxruntime_openvino-1.17.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2ce3b1aa06d6b8b732d314d217028ec4735de5806215c44d3bdbcad03b9260d5"},
 | 
				
			||||||
    {file = "onnxruntime_openvino-1.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d0c5808b7b876e5f6a083228bd43fc1028096cb9b485f466bf980d8f72d8424d"},
 | 
					    {file = "onnxruntime_openvino-1.17.1-cp311-cp311-win_amd64.whl", hash = "sha256:21133a701bb07ea19e01f48b8c23beee575f2e879f49173843f275d7c91a625a"},
 | 
				
			||||||
 | 
					    {file = "onnxruntime_openvino-1.17.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:76824dac3c392ad4b812f29c18be2055ab3bba2e3c111e44baae847b33d5b081"},
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[package.dependencies]
 | 
					[package.dependencies]
 | 
				
			||||||
coloredlogs = "*"
 | 
					coloredlogs = "*"
 | 
				
			||||||
flatbuffers = "*"
 | 
					flatbuffers = "*"
 | 
				
			||||||
numpy = ">=1.21.6"
 | 
					numpy = ">=1.25.2"
 | 
				
			||||||
packaging = "*"
 | 
					packaging = "*"
 | 
				
			||||||
protobuf = "*"
 | 
					protobuf = "*"
 | 
				
			||||||
sympy = "*"
 | 
					sympy = "*"
 | 
				
			||||||
@ -3626,4 +3627,4 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
 | 
				
			|||||||
[metadata]
 | 
					[metadata]
 | 
				
			||||||
lock-version = "2.0"
 | 
					lock-version = "2.0"
 | 
				
			||||||
python-versions = ">=3.10,<3.12"
 | 
					python-versions = ">=3.10,<3.12"
 | 
				
			||||||
content-hash = "c947090d326e81179054b7ce4dded311df8b7ca5a56680d5e9459cf8ca18df1a"
 | 
					content-hash = "1b014276ec94f9389459a70d31f0d96d1dd5a138bcc988900865e5f07a72bc62"
 | 
				
			||||||
 | 
				
			|||||||
@ -51,7 +51,7 @@ onnxruntime-gpu = {version = "^1.17.0", source = "cuda12"}
 | 
				
			|||||||
optional = true
 | 
					optional = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[tool.poetry.group.openvino.dependencies]
 | 
					[tool.poetry.group.openvino.dependencies]
 | 
				
			||||||
onnxruntime-openvino = ">=1.15.0,<1.16.0"
 | 
					onnxruntime-openvino = "^1.17.1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[tool.poetry.group.armnn]
 | 
					[tool.poetry.group.armnn]
 | 
				
			||||||
optional = true
 | 
					optional = true
 | 
				
			||||||
 | 
				
			|||||||
@ -1,8 +1,11 @@
 | 
				
			|||||||
#!/usr/bin/env sh
 | 
					#!/usr/bin/env sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
lib_path="/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2"
 | 
					lib_path="/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2"
 | 
				
			||||||
 | 
					# mimalloc seems to increase memory usage dramatically with openvino, need to investigate
 | 
				
			||||||
 | 
					if ! [ "$DEVICE" = "openvino" ]; then 
 | 
				
			||||||
	export LD_PRELOAD="$lib_path"
 | 
						export LD_PRELOAD="$lib_path"
 | 
				
			||||||
	export LD_BIND_NOW=1
 | 
						export LD_BIND_NOW=1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: "${MACHINE_LEARNING_HOST:=[::]}"
 | 
					: "${MACHINE_LEARNING_HOST:=[::]}"
 | 
				
			||||||
: "${MACHINE_LEARNING_PORT:=3003}"
 | 
					: "${MACHINE_LEARNING_PORT:=3003}"
 | 
				
			||||||
 | 
				
			|||||||
@ -429,7 +429,6 @@ export class AssetStore {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  removeAssets(ids: string[]) {
 | 
					  removeAssets(ids: string[]) {
 | 
				
			||||||
    const idSet = new Set(ids);
 | 
					    const idSet = new Set(ids);
 | 
				
			||||||
    this.assets = this.assets.filter((asset) => !idSet.has(asset.id));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Iterate in reverse to allow array splicing.
 | 
					    // Iterate in reverse to allow array splicing.
 | 
				
			||||||
    for (let index = this.buckets.length - 1; index >= 0; index--) {
 | 
					    for (let index = this.buckets.length - 1; index >= 0; index--) {
 | 
				
			||||||
@ -441,16 +440,13 @@ export class AssetStore {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bucket.assets.splice(index_, 1);
 | 
					        bucket.assets.splice(index_, 1);
 | 
				
			||||||
        bucket.bucketCount = bucket.assets.length;
 | 
					        if (bucket.assets.length === 0) {
 | 
				
			||||||
        if (bucket.bucketCount === 0) {
 | 
					 | 
				
			||||||
          this.buckets.splice(index, 1);
 | 
					          this.buckets.splice(index, 1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        delete this.assetToBucket[asset.id];
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.emit(false);
 | 
					    this.emit(true);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async getPreviousAssetId(assetId: string): Promise<string | null> {
 | 
					  async getPreviousAssetId(assetId: string): Promise<string | null> {
 | 
				
			||||||
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 758 KiB  | 
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user