HumanSignal/label-studio-ml-backend

When setting up the segment_anything_2_video environment, an error occurred, preventing the normal activation of label-studio-ml

Opened this issue · 1 comments

I want to use segment_anything_2_video in conjunction with label-studio for video annotation, but when I run label-studio-ml start .\segment_anything_2_video in the directory C:\Users\Admin\label-studio-ml-backend\label_studio_ml\examples, the following error occurs:

**Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\hydra_internal\instantiate_instantiate2.py", line 92, in _call_target
return target(*args, **kwargs)
File "C:\Users\Admin\label-studio-ml-backend\label_studio_ml\sam2\sam2\sam2_video_predictor.py", line 36, in init
super().init(**kwargs)
TypeError: SAM2Base.init() missing 3 required positional arguments: 'image_encoder', 'memory_attention', and 'memory_encoder'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\Admin\label-studio-ml-backend\label_studio_ml\examples\segment_anything_2_video_wsgi.py", line 33, in
from model import NewModel
File "C:\Users\Admin\label-studio-ml-backend\label_studio_ml\examples\segment_anything_2_video\model.py", line 39, in
predictor = build_sam2_video_predictor(MODEL_CONFIG, sam2_checkpoint)
File "C:\Users\Admin\label-studio-ml-backend\label_studio_ml\sam2\sam2\build_sam.py", line 129, in build_sam2_video_predictor
model = instantiate(cfg.model, recursive=True)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\hydra_internal\instantiate_instantiate2.py", line 226, in instantiate
return instantiate_node(
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\hydra_internal\instantiate_instantiate2.py", line 347, in instantiate_node
return _call_target(target, partial, args, kwargs, full_key)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\hydra_internal\instantiate_instantiate2.py", line 97, in _call_target
raise InstantiationException(msg) from e
hydra.errors.InstantiationException: Error in call to target 'sam2.sam2_video_predictor.SAM2VideoPredictor':
TypeError("SAM2Base.init() missing 3 required positional arguments: 'image_encoder', 'memory_attention', and 'memory_encoder'")
full_key: model**

I have been trying for a while. Has anyone encountered the same issue? I need assistance. Thank you very much.

Path to execute SAM2 : C:\Users\Admin\label-studio-ml-backend\label_studio_ml\examples\segment_anything_2_video
Installation path for SAM 2.1 development kit : C:\Users\Admin\label-studio-ml-backend\label_studio_ml\sam2

( OS : Windows 11 )

Here are the versions of the software :
python => 3.10.11
torch => 2.4.1+cu118
torchvision => 0.19.1+cpu
cuda => 11.8

The recommended way to run ML backends is to use docker compose.

These errors look like incorrect dependencies in your python packages and docker-compose typically solves it.