Fix/model runtime (#1873)

This commit is contained in:
Yeuoly 2024-01-03 11:36:57 +08:00 committed by GitHub
parent 5a2aa83030
commit b43f1441a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,10 +33,13 @@ class XinferenceHelper:
@staticmethod @staticmethod
def _clean_cache() -> None: def _clean_cache() -> None:
try:
with cache_lock: with cache_lock:
for model_uid, model in cache.items(): expired_keys = [model_uid for model_uid, model in cache.items() if model['expires'] < time()]
if model['expires'] < time(): for model_uid in expired_keys:
del cache[model_uid] del cache[model_uid]
except RuntimeError as e:
pass
@staticmethod @staticmethod
def _get_xinference_extra_parameter(server_url: str, model_uid: str) -> XinferenceModelExtraParameter: def _get_xinference_extra_parameter(server_url: str, model_uid: str) -> XinferenceModelExtraParameter: