mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(ml): improve test coverage (#7041)
* update e2e * tokenizer tests * more tests, remove unnecessary code * fix e2e setting * add tests for loading model * update workflow * fixed test
This commit is contained in:
parent
6e853e2a9d
commit
0c4df216d7
8 changed files with 501 additions and 1636 deletions
|
|
@ -119,16 +119,12 @@ async def load(model: InferenceModel) -> InferenceModel:
|
|||
if model.loaded:
|
||||
return model
|
||||
|
||||
def _load() -> None:
|
||||
def _load(model: InferenceModel) -> None:
|
||||
with lock:
|
||||
model.load()
|
||||
|
||||
loop = asyncio.get_running_loop()
|
||||
try:
|
||||
if thread_pool is None:
|
||||
model.load()
|
||||
else:
|
||||
await loop.run_in_executor(thread_pool, _load)
|
||||
await run(_load, model)
|
||||
return model
|
||||
except (OSError, InvalidProtobuf, BadZipFile, NoSuchFile):
|
||||
log.warning(
|
||||
|
|
@ -138,10 +134,7 @@ async def load(model: InferenceModel) -> InferenceModel:
|
|||
)
|
||||
)
|
||||
model.clear_cache()
|
||||
if thread_pool is None:
|
||||
model.load()
|
||||
else:
|
||||
await loop.run_in_executor(thread_pool, _load)
|
||||
await run(_load, model)
|
||||
return model
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue