try using caching to speed up pipeline loads

This commit is contained in:
Francisco Schulz 2023-02-09 16:53:13 +01:00
parent 1b9df61261
commit e3620f33e8

View File

@ -1,5 +1,5 @@
import os import os
from functools import partial from functools import partial, lru_cache
from itertools import chain, tee from itertools import chain, tee
from typing import Iterable from typing import Iterable
@ -20,6 +20,7 @@ from image_prediction.utils.generic import lift, starlift
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
@lru_cache()
def load_pipeline(**kwargs): def load_pipeline(**kwargs):
model_loader = get_mlflow_model_loader(MLRUNS_DIR) model_loader = get_mlflow_model_loader(MLRUNS_DIR)
model_identifier = CONFIG.service.mlflow_run_id model_identifier = CONFIG.service.mlflow_run_id