mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	fix(ml): clear cache if bad zip file (#3600)
This commit is contained in:
		| @@ -4,6 +4,7 @@ from abc import ABC, abstractmethod | |||||||
| from pathlib import Path | from pathlib import Path | ||||||
| from shutil import rmtree | from shutil import rmtree | ||||||
| from typing import Any | from typing import Any | ||||||
|  | from zipfile import BadZipFile | ||||||
|  |  | ||||||
| from onnxruntime.capi.onnxruntime_pybind11_state import InvalidProtobuf  # type: ignore | 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 |         loader = self.load if eager else self.download | ||||||
|         try: |         try: | ||||||
|             loader(**model_kwargs) |             loader(**model_kwargs) | ||||||
|         except (OSError, InvalidProtobuf): |         except (OSError, InvalidProtobuf, BadZipFile): | ||||||
|             self.clear_cache() |             self.clear_cache() | ||||||
|             loader(**model_kwargs) |             loader(**model_kwargs) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user