Refactor by adding context

Signed-off-by: András Schmelczer <andras@schmelczer.dev>
This commit is contained in:
Andras Schmelczer 2022-04-09 18:53:57 +02:00
commit a03e78bb73

View file

@ -4,17 +4,16 @@ from typing import Optional, Union
from joblib import dump
from good_ai.good_ai.context.get_context import get_context
from good_ai.open_s3 import LargeFile
from ..set_default_config import set_default_config_if_uninitialized
logger = logging.getLogger("models")
def save_model(
model: Union[Path, str, object], key: str, keep_last_n: Optional[int] = None
) -> int:
set_default_config_if_uninitialized()
get_context() # will setup LargeFile if there was no config set
file = LargeFile(name=key, mode="wb", keep_last_n=keep_last_n)