HumanSignal / label-studio-ml-backend

Configs and boilerplates for Label Studio's Machine Learning backend
Apache License 2.0
585 stars 261 forks source link

sam2 image ml backend installation error #669

Open Thomas-J-Kidd opened 3 days ago

Thomas-J-Kidd commented 3 days ago

Is anyone else getting an issue when trying to set up sam2 image ml backend? I get this after I modify model.py to match my checkpoints and other environmental variables.

(test-environment) % label-studio-ml start ./segment_anything_2_image 
Traceback (most recent call last):
  File "/media/***/sam-2-test-v2/label-studio-ml-backend/label_studio_ml/examples/././segment_anything_2_image/_wsgi.py", line 33, in <module>
    from model import NewModel
  File "/media/***/sam-2-test-v2/label-studio-ml-backend/label_studio_ml/examples/segment_anything_2_image/model.py", line 12, in <module>
    from sam2.build_sam import build_sam2
  File "/media/***/sam-2-test-v2/label-studio-ml-backend/label_studio_ml/examples/segment_anything_2_image/sam2/sam2/build_sam.py", line 25, in <module>
    raise RuntimeError(
RuntimeError: You're likely running Python from the parent directory of the sam2 repository (i.e. the directory where https://github.com/facebookresearch/sam2 is cloned into). This is not supported since the `sam2` Python package could be shadowed by the repository name (the repository is also named `sam2` and contains the Python package in `sam2/sam2`). Please run Python from another directory (e.g. from the repo dir rather than its parent dir, or from your home directory) after installing SAM 2.
jguo1002 commented 1 day ago

Rename sam2 directory (the one you git cloned) to segment-anything-2.