Run this model with HF Jobs

Run facebook/sam3 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/facebook/sam3. Ask me which dataset to train on, then push the fine-tuned model to a new private model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/facebook/sam3 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

how do I run the model offline?

#45
by ffrige - opened

I'm running on a Windows machine. The model was downloaded to ...cache\huggingface\hub\models--facebook--sam3 correctly. However, whenever I run my Python script, the program attempts a connection to huggingface. It works fine when I am online, but it fails when I am offline.
What do I need to do in order to run offline?
How do I reference the "model = build_sam3_image_model()" line to the cached model?

I found the answer on my own:

model = build_sam3_image_model(checkpoint_path='/.cache/huggingface/hub/models--facebook--sam3/sam3.pt')

ffrige changed discussion status to closed

same problem not working for me
"Sam3VideoModel" from_pretrained triggering download despite local_files_only

@Binivert
from PIL import Image

pil_image = Image.open("1.jpg")

from sam3 import build_sam3_image_model
from sam3.model.sam3_image_processor import Sam3Processor
model = build_sam3_image_model(
bpe_path="assets/bpe_simple_vocab_16e6.txt.gz",
device="cuda",
eval_mode=True,
checkpoint_path="sam3.pt",
load_from_HF=False,

)
processor = Sam3Processor(model, device="cuda")
state = processor.set_image(pil_image)
#state = processor.set_text_prompt("white bicycle", state)
output = processor.set_text_prompt(state=state, prompt="white bicycle")
#print(state["masks"].shape)
masks, boxes, scores = output["masks"], output["boxes"], output["scores"]
print(masks, boxes, scores )

Sign up or log in to comment