autodistill / autodistill-grounded-sam-2

Use Segment Anything 2, grounded with Florence-2, to auto-label data for use in training vision models.
https://docs.autodistill.com
Apache License 2.0
92 stars 13 forks source link

Is this already working? #1

Open nikste opened 3 months ago

nikste commented 3 months ago

Hi! is this already in a usable state? I've installed it with pip3 install autodistill-grounded-sam-2 autodistill-yolov8 trying the sample code from the readme results in:

    from autodistill_grounded_sam_2 import GroundedSAM2
  File "autodistill-grounded-sam-2/autodistill_grounded_sam_2/__init__.py", line 1, in <module>
    from autodistill_grounded_sam_2.grounded_sam_2 import GroundedSAM2
  File "autodistill-grounded-sam-2/autodistill_grounded_sam_2/grounded_sam_2.py", line 16, in <module>
    from autodistill_grounded_sam_2.helpers import load_SAM, load_grounding_dino, combine_detections
  File "autodistill-grounded-sam-2/autodistill_grounded_sam_2/helpers.py", line 5, in <module>
    from groundingdino.util.inference import Model
ModuleNotFoundError: No module named 'groundingdino'

did i go wrong somewhere?

HaneeshMekala commented 3 months ago

pip3 install autodistill-grounding-dino

Try this

capjamesg commented 3 months ago

Hello there! We are working on a new release with a bug fix for this. The fix is already available on the main branch of this repository, and should thus be installable with:

pip install git+https://github.com/autodistill/autodistill-grounded-sam-2

Let me know if this doesn't work, or if you run into any more issues.

jaimecorton commented 3 months ago

Hello guys!

I am trying to pip install autodistill-grounded-sam-2 into my venv (Pip version 24.2. Python 3.9.13 on VSCode) through py -m pip install autodistill-grounded-sam-2 and I am getting a build wheel error because of ModuleNotFoundError: No module named 'torch'. Running a quick pip freeze I can see that I have torch installed already:

This is the full console message:

 Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "Env\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "Env\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "Env\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "\Temp\pip-build-env-gf3d792_\overlay\Lib\site-packages\setuptools\build_meta.py", line 327, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
        File "\Temp\pip-build-env-gf3d792_\overlay\Lib\site-packages\setuptools\build_meta.py", line 297, in _get_build_requires    
          self.run_setup()
        File "\Temp\pip-build-env-gf3d792_\overlay\Lib\site-packages\setuptools\build_meta.py", line 497, in run_setup
          super().run_setup(setup_script=setup_script)
        File "\Temp\pip-build-env-gf3d792_\overlay\Lib\site-packages\setuptools\build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 21, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Is there something I might be missing? Thank you in advance!

Jaime

walternat1ve commented 2 months ago

@jaimecorton whenever you get such an error (and you get plenty of those in this installation process) you just try to install the dependency manually. in this case is would be: python -m pip install torch afterwards you try the installation process again and it should work if not another dependency is missing for some reason.

i have the feeling this hasnt been tested in a clean environment.