mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(ml): load models in separate threads (#4034)
* load models in thread * set clip mode logs to debug level * updated tests * made fixtures slightly less ugly * moved responses to json file * formatting
This commit is contained in:
parent
f1db257628
commit
258b98c262
9 changed files with 1683 additions and 114 deletions
|
|
@ -26,7 +26,7 @@ class FaceRecognizer(InferenceModel):
|
|||
self.min_score = model_kwargs.pop("minScore", min_score)
|
||||
super().__init__(model_name, cache_dir, **model_kwargs)
|
||||
|
||||
def _download(self, **model_kwargs: Any) -> None:
|
||||
def _download(self) -> None:
|
||||
zip_file = self.cache_dir / f"{self.model_name}.zip"
|
||||
download_file(f"{BASE_REPO_URL}/{self.model_name}.zip", zip_file)
|
||||
with zipfile.ZipFile(zip_file, "r") as zip:
|
||||
|
|
@ -36,7 +36,7 @@ class FaceRecognizer(InferenceModel):
|
|||
zip.extractall(self.cache_dir, members=[det_file, rec_file])
|
||||
zip_file.unlink()
|
||||
|
||||
def _load(self, **model_kwargs: Any) -> None:
|
||||
def _load(self) -> None:
|
||||
try:
|
||||
det_file = next(self.cache_dir.glob("det_*.onnx"))
|
||||
rec_file = next(self.cache_dir.glob("w600k_*.onnx"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue