Instructions to use facebook/sam-vit-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/sam-vit-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("mask-generation", model="facebook/sam-vit-base")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMaskGeneration processor = AutoProcessor.from_pretrained("facebook/sam-vit-base") model = AutoModelForMaskGeneration.from_pretrained("facebook/sam-vit-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Commit History
-
Fix: Align model and input data types to float16 for inference
Verified signature## Description This PR fixes a runtime error in the example code caused by a mismatch between the input tensor type and the model weights during inference. ## Changes - Converted the model to float16: model = model.to("cuda").half() - Converted float32 input tensors from the processor to float16: inputs = {k: v.half() if isinstance(v, torch.Tensor) and v.dtype == torch.float32 else v for k, v in inputs.items()} ## Testing The code has been successfully tested and runs without error. ## Note This contribution is part of an ongoing research initiative to systematically identify and correct faulty example code in Hugging Face Model Cards. We would appreciate a timely review and integration of this patch to support code reliability and enhance reproducibility for downstream users.57bbb26
-
Update README.md
Verified signature70c1a07
-
Adding `safetensors` variant of this model (#5)
- Adding `safetensors` variant of this model (bdccba0edd5be41d39e2d1ab417fc9c536508544) Co-authored-by: Safetensors convertbot <SFconvertbot@users.noreply.huggingface.co>d0d9250
-
Update README.md (#2)
- Update README.md (0b40a4fdabc45afbaa0b6278d743eeb621d2f9ba) - Update README.md (f6d135382339e4c0dfde18a7c079a536dc2e1e92) Co-authored-by: Younes Belkada <ybelkada@users.noreply.huggingface.co>b5fc599
-
Add TF weights
bf6e013
-
Update README.md (#1)
- Update README.md (3b5939ceab4e75f5f40b9092544f96e06f4b1c80)aec582a
-
Update README.md
a7c34ea
-
Update README.md
91d4ca2 -
Create README.md
d451a11 -
Upload processor
02a33af -
Upload model
01a63de -
initial commit
Younes Belkada3d25a77