From d239368d703b9fc64f9e8f3f34b6fc9e127b1393 Mon Sep 17 00:00:00 2001 From: Francisco Schulz Date: Tue, 14 Feb 2023 16:27:21 +0100 Subject: [PATCH] cache loaded pipeline & disable tqdm output by default --- image_prediction/pipeline.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/image_prediction/pipeline.py b/image_prediction/pipeline.py index 704a88f..2bff17a 100644 --- a/image_prediction/pipeline.py +++ b/image_prediction/pipeline.py @@ -1,7 +1,6 @@ import os -from functools import partial +from functools import lru_cache, partial from itertools import chain, tee -from typing import Iterable from funcy import rcompose, first, compose, second, chunks, identity, rpartial from tqdm import tqdm @@ -20,6 +19,7 @@ from image_prediction.utils.generic import lift, starlift os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" +@lru_cache(maxsize=None) def load_pipeline(**kwargs): model_loader = get_mlflow_model_loader(MLRUNS_DIR) model_identifier = CONFIG.service.mlflow_run_id @@ -38,7 +38,7 @@ def star(f): class Pipeline: - def __init__(self, model_loader, model_identifier, batch_size=16, verbose=True, **kwargs): + def __init__(self, model_loader, model_identifier, batch_size=16, verbose=False, **kwargs): self.verbose = verbose extract = get_extractor(**kwargs)