Instructions to use Pablopigue/sam2-lite with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sam2
How to use Pablopigue/sam2-lite with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained("Pablopigue/sam2-lite") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): predictor.set_image(<your_image>) masks, _, _ = predictor.predict(<input_prompts>)# Use SAM2 with videos import torch from sam2.sam2_video_predictor import SAM2VideoPredictor predictor = SAM2VideoPredictor.from_pretrained("Pablopigue/sam2-lite") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): state = predictor.init_state(<your_video>) # add new prompts and instantly get the output on the same frame frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>) # propagate the prompts to get masklets throughout the video for frame_idx, object_ids, masks in predictor.propagate_in_video(state): ... - Notebooks
- Google Colab
- Kaggle
Download NOTICE from Pablopigue/sam2-lite: direct link, hf CLI and curl.
- Browser
- Download file 2.98 kB
-
https://huggingface.co/Pablopigue/sam2-lite/resolve/main/NOTICE
- Command line
-
hf download hf://Pablopigue/sam2-lite/NOTICE
-
curl -L -o NOTICE https://huggingface.co/Pablopigue/sam2-lite/resolve/main/NOTICE
2.98 kB
| sam2-lite | |
| Copyright 2026 pablopigue | |
| sam2-lite is an independent project; it is not affiliated with, endorsed by or sponsored by | |
| Meta. "SAM 2" refers to the original model by Meta FAIR, on which this work is based. | |
| The parts of sam2-lite are under different licenses: | |
| 1. Source code: Apache License 2.0, except for the files listed in 2 and 3. A copy of the | |
| license is included: LICENSE in the source repository, LICENSE-APACHE-2.0 in the model | |
| repository. | |
| 2. src/sam2lite/eval/third_party/sav_benchmark.py: SAM 2's J&F evaluator, vendored unmodified | |
| from https://github.com/facebookresearch/sam2, with its licenses in the | |
| same folder: | |
| LICENSE BSD 3-Clause License, SAM 2 Eval software (Meta Platforms, Inc.) | |
| LICENSE_DAVIS BSD 3-Clause License, DAVIS (davis2017-evaluation) | |
| LICENSE_VOS_BENCHMARK MIT License, Rex Cheng (vos-benchmark) | |
| 3. Media, not under the Apache License: the example videos (app/examples/*.mp4) and the README | |
| animations (assets/demo.gif, made from swans.mp4; assets/hard_case.gif, made from | |
| train-viaduct_teacher_vs_student.mp4) are clips of Wikimedia Commons videos licensed under | |
| CC BY 2.0 and CC BY 3.0: cut, re-encoded and, where noted, with masks drawn. Titles, authors, | |
| sources and licenses: app/examples/ATTRIBUTION.md. | |
| 4. Models (https://huggingface.co/Pablopigue/sam2-lite): Creative Commons | |
| Attribution-NonCommercial 4.0 International (CC BY-NC 4.0), | |
| https://creativecommons.org/licenses/by-nc/4.0/. For non-commercial research use only, | |
| because of the data in 5 and 6. They contain: | |
| - SAM 2.1 Hiera-tiny weights by Meta Platforms, Inc., Apache License 2.0, | |
| https://github.com/facebookresearch/sam2. Modified: the memory attention (fine-tuned to | |
| attend to 3 memory frames instead of 7) and the memory temporal encodings (3 of the 7 | |
| kept). The other SAM 2.1 weights (memory encoder, prompt encoder, mask decoder, object | |
| pointers) are included unchanged and remain available under the Apache License 2.0. | |
| - timm weights timm/mobilenetv4_conv_medium.e500_r224_in1k (Ross Wightman), Apache License | |
| 2.0, https://huggingface.co/timm/mobilenetv4_conv_medium.e500_r224_in1k. Modified: the | |
| image encoder starts from them and was trained by distillation. | |
| 5. ImageNet-1k: the timm weights in 4 were trained on it, and its terms of access allow only | |
| non-commercial research and educational use (https://image-net.org/download.php). | |
| 6. DAVIS 2017 (https://davischallenge.org; Pont-Tuset et al., 2017; Perazzi et al., 2016): | |
| CC BY-NC 4.0, as stated in the Terms of Use of the official dataset package. About half of | |
| its sequences (31 of 60 in train, 15 of 30 in val) come from third-party online sources, | |
| mostly YouTube, with their own terms of use (listed in the package's SOURCES.md). The models | |
| were distilled on DAVIS 2017 train frames and evaluated on DAVIS 2017 val. No DAVIS videos, | |
| frames or annotations are redistributed. | |