renamed module
Code Quality Pipeline / Check Code (pull_request) Successful in 2m40s

This commit is contained in:
brian
2024-10-24 16:19:52 +00:00
parent 860150905d
commit 30f37b6ca5
26 changed files with 17 additions and 17 deletions
+30
View File
@@ -0,0 +1,30 @@
"""Definition of get_model function."""
import logging
from collections import OrderedDict
import torch
from minio import Minio
from .get import get
def get_model(
client: Minio,
object_name: str,
) -> OrderedDict:
"""Get model from model subfolder in bucket in Minio."""
assert isinstance(client, Minio)
assert isinstance(object_name, str)
subfolder = 'models'
object_name = f'{subfolder}/{object_name}'
# get buffer
buffer = get(
client=client,
object_name=object_name,
)
# convert data to model checkpoint
buffer.seek(0)
model_content = torch.load(buffer)
logging.debug('finished')
return model_content