1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-16 00:36:47 +01:00

fix(ml): clear cache if bad zip file (#3600)

This commit is contained in:
Mert 2023-08-08 13:33:13 -04:00 committed by GitHub
parent ddd4ec2d9e
commit fa57853bd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@ from abc import ABC, abstractmethod
from pathlib import Path
from shutil import rmtree
from typing import Any
from zipfile import BadZipFile
from onnxruntime.capi.onnxruntime_pybind11_state import InvalidProtobuf # type: ignore
@ -23,7 +24,7 @@ class InferenceModel(ABC):
loader = self.load if eager else self.download
try:
loader(**model_kwargs)
except (OSError, InvalidProtobuf):
except (OSError, InvalidProtobuf, BadZipFile):
self.clear_cache()
loader(**model_kwargs)