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