Open casabelle42 opened 4 weeks ago
Same issue. I get,
fatal: destination path 'segment-anything-2' already exists and is not an empty directory.
And then it proceeds to reinstall. There should probably be a simple check in GroundedSAM2 from autodistill_grounded_sam_2 that needs to be changed if the library was already built.
in helpers.py
there's this check which mistakenly always performs a re-installation:
if not os.path.isdir("~/.cache/autodistill/segment_anything_2/segment-anything-2"):
subprocess.run(
[
"git",
"clone",
"https://github.com/facebookresearch/segment-anything-2.git",
]
)
os.chdir("segment-anything-2")
subprocess.run(["pip", "install", "-e", "."])
This is called in grounded_sam_2.py
.
Simplest workaround is to copy the grounded_sam_2 file to your local workspace and also create your own load_SAM() function which removes the check (or has the correct check)
This also has the benefit of you being able to control which SAM model to use!
if not os.path.exists(os.path.expanduser("~/.cache/autodistill/segment_anything_2/segment-anything-2")):
yeah, this is really in bad shape. already the installation was not straight forward as expected. had to install many dependencies manually.
When I call on GroundedSAM2 with the ontology, it reinstalls SAM2 every time I run the program. Is there some sort of flag I can set that would stop that behavior? It will reinstall SAM2 with the same version even if I have previously run it moments ago.