pip install -q transformers
Mask Generation Pipeline
The easiest way to infer mask generation models is to use the mask-generation pipeline.
thon

from transformers import pipeline
checkpoint = "facebook/sam-vit-base"
mask_generator = pipeline(model=checkpoint, task="mask-generation")