mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat: preloading of machine learning models (#7540)
This commit is contained in:
parent
762c4684f8
commit
e8b001f62f
6 changed files with 75 additions and 49 deletions
|
|
@ -6,7 +6,7 @@ from pathlib import Path
|
|||
from socket import socket
|
||||
|
||||
from gunicorn.arbiter import Arbiter
|
||||
from pydantic import BaseSettings
|
||||
from pydantic import BaseModel, BaseSettings
|
||||
from rich.console import Console
|
||||
from rich.logging import RichHandler
|
||||
from uvicorn import Server
|
||||
|
|
@ -15,6 +15,11 @@ from uvicorn.workers import UvicornWorker
|
|||
from .schemas import ModelType
|
||||
|
||||
|
||||
class PreloadModelData(BaseModel):
|
||||
clip: str | None
|
||||
facial_recognition: str | None
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
cache_folder: str = "/cache"
|
||||
model_ttl: int = 300
|
||||
|
|
@ -27,10 +32,12 @@ class Settings(BaseSettings):
|
|||
model_inter_op_threads: int = 0
|
||||
model_intra_op_threads: int = 0
|
||||
ann: bool = True
|
||||
preload: PreloadModelData | None = None
|
||||
|
||||
class Config:
|
||||
env_prefix = "MACHINE_LEARNING_"
|
||||
case_sensitive = False
|
||||
env_nested_delimiter = "__"
|
||||
|
||||
|
||||
class LogSettings(BaseSettings):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue