Open KD1994 opened 1 year ago
Facing same issue. @makseq Please take a look.
I am also having this problem.
I am having this problem as well
I currently use singleton to avoid this problem.
def singleton(cls):
_instance = {}
def inner():
if cls not in _instance:
_instance[cls] = cls()
return _instance[cls]
return inner
@singleton
class DetectorCls(object):
def __init__(self):
print('Detector init')
class NewModel(LabelStudioMLBase):
def __init__(self, project_id, **kwargs):
super(NewModel, self).__init__(project_id, **kwargs)
self.detector = DetectorCls()
Label-studio: 1.7.3 Label-studio-ml: 1.0.8rc3
command I use:
label-studio-ml start yolov7 --kwargs hostname=<host_name:port> access_token=<API_KEY> weights_path=/workspace/LS_ML_Backend/yolov7/runs/train/yolov7-custom-15/weights/best.pt device=cuda:0 img_dir=/workspace/LS_ML_Backend/Data/Images
I trained a model --> then selected that model in Label-studio UI for predictions.Query:
Why is model being loaded every time for each prediction? Is it expected behavior? If not, could you please tell me what needs to be done. I see an issue related to this: #192
Tried & failed:
Label-studio-ml Logs: