Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Colab support to the notebooks; pack config files in sam2_configs package during installation #176

Merged
merged 3 commits into from
Aug 8, 2024

Conversation

ronghanghu
Copy link
Contributor

@ronghanghu ronghanghu commented Aug 8, 2024

In this PR, we add Colab support to all the three notebooks.

They can be tested as follows from the ronghanghu:ronghanghu/colab branch in this PR before merging

(to test them before merging, set using_colab = True and replace git+https://github.com/facebookresearch/segment-anything-2.git with git+https://github.com/ronghanghu/segment-anything-2.git@ronghanghu/colab in the Colab environment setup cell.)

Besides, we also add the following lines

    package_data={"": ["*.yaml"]},  # SAM 2 configuration files
    include_package_data=True,

to setup in setup.py to copy over the SAM 2 config YAML files into the sam2_configs packages after installation (see https://stackoverflow.com/questions/1612733/including-non-python-files-with-setup-py), which should resolve #51.


All 3 notebooks tested in Colab and work well. Example running image_predictor_example.ipynb in Colab (using L4 GPU):

Screenshot 2024-08-07 at 10 03 42 PM

@ronghanghu ronghanghu requested a review from haithamkhedr August 8, 2024 05:11
@ronghanghu ronghanghu marked this pull request as ready for review August 8, 2024 05:11
@ronghanghu ronghanghu mentioned this pull request Aug 8, 2024
@ronghanghu ronghanghu merged commit d421e0b into facebookresearch:main Aug 8, 2024
2 checks passed
fbcotter added a commit to wayveai/segment-anything-2 that referenced this pull request Sep 6, 2024
… into facebookresearch-main

* 'main' of github.com:facebookresearch/segment-anything-2: (40 commits)
  open `README.md` with unicode (to support Hugging Face emoji); fix various typos (facebookresearch#218)
  accept kwargs in auto_mask_generator
  Fix HF image predictor
  improving warning message and adding further tips for installation (facebookresearch#204)
  better support for non-CUDA devices (CPU, MPS) (facebookresearch#192)
  Update hieradet.py
  add Colab support to the notebooks; pack config files in `sam2_configs` package during installation (facebookresearch#176)
  also catch errors during installation in case `CUDAExtension` cannot be loaded (facebookresearch#175)
  Add interface for box prompt in SAM 2 video predictor (facebookresearch#174)
  Address comment
  Update hieradet.py
  Update docstrings
  Revert code snippet
  Updated INSTALL.md with CUDA_HOME-related troubleshooting (facebookresearch#140)
  Format using ufmt
  Update INSTALL.md (facebookresearch#156)
  Update README
  Make it optional to build CUDA extension for SAM 2; also fallback to all available kernels if Flash Attention fails (facebookresearch#155)
  Clean up
  Address comment
  ...
yanyilyu pushed a commit to yanyilyu/segment-anything-2 that referenced this pull request Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The python package should ship with model configs
3 participants