Run this model with HF Jobs
Run zeromodels/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/zeromodels/sam3. Ask me which dataset to train on, then push the fine-tuned model to a new 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/zeromodels/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.
Instructions to use zeromodels/sam3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ZeroModels
How to use zeromodels/sam3 with ZeroModels:
# pip install -U zeromodels # ZeroModels is pure Keras 3, so pick a backend: "jax", "torch" or "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" from zeromodels import AutoZModel # AutoZModel reads the repo's model_type and loads the matching class. # For a task head use the matching loader, e.g. AutoZMImageClassify / AutoZMDetect / # AutoZMSemanticSegment / AutoZMTextGenerate (see zeromodels.auto). model = AutoZModel.from_weights("zeromodels/sam3") - Keras
How to use zeromodels/sam3 with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://zeromodels/sam3") - Notebooks
- Google Colab
- Kaggle
Migrate to zeromodels (rename kf_*.json -> zm_*.json, fix refs in config + README, ensure tag + badge)
Browse filesFiles changed (3)
- README.md+18-18
- kf_config.json → zm_config.jsonRenamed+51-51
- kf_preprocessor.json → zm_preprocessor.jsonRenamed+18-18
3 unmodified lines456789101112133 unmodified lines171819202122232425262728291 unmodified line313233343536373 unmodified lines414243444546474849505152535455565758596061626364656667686970717273743 unmodified lineslicense_name: sam-licenselicense_link: https://github.com/facebookresearch/sam3/blob/main/LICENSEbase_model: facebook/sam3library_name: kerasformerstags:- keras- kerasformers- sam3- mask-generation- image-segmentation3 unmodified lines- tf---## ***See [our collection](https://huggingface.co/collections/kerasformers/sam-v1-v2-v3-6a6a8c261dabbc2996e1b4a2) for all versions of SAM.***# Run SAM3 with Keras 3: JAX, PyTorch, or TensorFlow[](https://github.com/IMvision12/KerasFormers) [](https://imvision12.github.io/KerasFormers/sam3/) [](https://huggingface.co/collections/kerasformers/sam-v1-v2-v3-6a6a8c261dabbc2996e1b4a2)# kerasformers/sam3Paper: [SAM 3: Segment Anything with Concepts (arXiv:2511.16719)](https://arxiv.org/abs/2511.16719) · [HF Papers](https://huggingface.co/papers/2511.16719)1 unmodified lineFor more details on the model, please go to Meta's original [model card](https://huggingface.co/facebook/sam3).Pure-**Keras 3** conversion of [`facebook/sam3`](https://huggingface.co/facebook/sam3) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**.This is a **concept-prompted** checkpoint (`SAM3InstanceSegment` / `SAM3Detect` / `SAM3SemanticSegment`): pass a text noun phrase (backbone ViT-L/14).3 unmodified linesimport osos.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"from kerasformers.models.sam3 import SAM3InstanceSegmentsegmenter = SAM3InstanceSegment.from_weights("kerasformers/sam3")result = segmenter.predict(images="your_image.jpg", text="person", threshold=0.3)[0]print(len(result["scores"]), result["masks"].shape)```Load any SAM / SAM2 / SAM3 variant the same way with `from_weights("kerasformers/<variant>")` (use `SAM3InstanceSegment` for this repo):| Variant | Hub | Family ||---|---|---|| `sam_vit_base` | [`kerasformers/sam_vit_base`](https://huggingface.co/kerasformers/sam_vit_base) | SAM || `sam_vit_large` | [`kerasformers/sam_vit_large`](https://huggingface.co/kerasformers/sam_vit_large) | SAM || `sam_vit_huge` | [`kerasformers/sam_vit_huge`](https://huggingface.co/kerasformers/sam_vit_huge) | SAM || `sam2_hiera_small` | [`kerasformers/sam2_hiera_small`](https://huggingface.co/kerasformers/sam2_hiera_small) | SAM2 || `sam2_hiera_base_plus` | [`kerasformers/sam2_hiera_base_plus`](https://huggingface.co/kerasformers/sam2_hiera_base_plus) | SAM2 || `sam2_hiera_large` | [`kerasformers/sam2_hiera_large`](https://huggingface.co/kerasformers/sam2_hiera_large) | SAM2 || `sam3` | [`kerasformers/sam3`](https://huggingface.co/kerasformers/sam3) | SAM3 |## Tips- Set `KERAS_BACKEND` **before** importing Keras / kerasformers.- SAM / SAM2: point coordinates are in original pixel space; box prompts need `enable_boxes=True` / `include_box_input=True` when building the graph.- SAM2 in this port is image-only (no video memory bank).- SAM3: prefer `SAM3InstanceSegment.predict(...)` for text prompts; upstream `facebook/sam3` is gated.- See [SAM3 docs](https://imvision12.github.io/KerasFormers/sam3/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).- Community / upstream safetensors still work via the `hf:` prefix, e.g. `SAM3Model.from_weights("hf:facebook/sam3")`.## Special Thanks3 unmodified lines456789101112133 unmodified lines171819202122232425262728291 unmodified line313233343536373 unmodified lines414243444546474849505152535455565758596061626364656667686970717273743 unmodified lineslicense_name: sam-licenselicense_link: https://github.com/facebookresearch/sam3/blob/main/LICENSEbase_model: facebook/sam3library_name: zeromodelstags:- keras- zeromodels- sam3- mask-generation- image-segmentation3 unmodified lines- tf---## ***See [our collection](https://huggingface.co/collections/zeromodels/sam-v1-v2-v3-6a6a8c261dabbc2996e1b4a2) for all versions of SAM.***# Run SAM3 with Keras 3: JAX, PyTorch, or TensorFlow[](https://github.com/IMvision12/ZeroModels) [](https://imvision12.github.io/ZeroModels/sam3/) [](https://huggingface.co/collections/zeromodels/sam-v1-v2-v3-6a6a8c261dabbc2996e1b4a2)# zeromodels/sam3Paper: [SAM 3: Segment Anything with Concepts (arXiv:2511.16719)](https://arxiv.org/abs/2511.16719) · [HF Papers](https://huggingface.co/papers/2511.16719)1 unmodified lineFor more details on the model, please go to Meta's original [model card](https://huggingface.co/facebook/sam3).Pure-**Keras 3** conversion of [`facebook/sam3`](https://huggingface.co/facebook/sam3) for [zeromodels](https://github.com/IMvision12/ZeroModels). One implementation runs unmodified on **TensorFlow / Torch / JAX**.This is a **concept-prompted** checkpoint (`SAM3InstanceSegment` / `SAM3Detect` / `SAM3SemanticSegment`): pass a text noun phrase (backbone ViT-L/14).3 unmodified linesimport osos.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"from zeromodels.models.sam3 import SAM3InstanceSegmentsegmenter = SAM3InstanceSegment.from_weights("zeromodels/sam3")result = segmenter.predict(images="your_image.jpg", text="person", threshold=0.3)[0]print(len(result["scores"]), result["masks"].shape)```Load any SAM / SAM2 / SAM3 variant the same way with `from_weights("zeromodels/<variant>")` (use `SAM3InstanceSegment` for this repo):| Variant | Hub | Family ||---|---|---|| `sam_vit_base` | [`zeromodels/sam_vit_base`](https://huggingface.co/zeromodels/sam_vit_base) | SAM || `sam_vit_large` | [`zeromodels/sam_vit_large`](https://huggingface.co/zeromodels/sam_vit_large) | SAM || `sam_vit_huge` | [`zeromodels/sam_vit_huge`](https://huggingface.co/zeromodels/sam_vit_huge) | SAM || `sam2_hiera_small` | [`zeromodels/sam2_hiera_small`](https://huggingface.co/zeromodels/sam2_hiera_small) | SAM2 || `sam2_hiera_base_plus` | [`zeromodels/sam2_hiera_base_plus`](https://huggingface.co/zeromodels/sam2_hiera_base_plus) | SAM2 || `sam2_hiera_large` | [`zeromodels/sam2_hiera_large`](https://huggingface.co/zeromodels/sam2_hiera_large) | SAM2 || `sam3` | [`zeromodels/sam3`](https://huggingface.co/zeromodels/sam3) | SAM3 |## Tips- Set `KERAS_BACKEND` **before** importing Keras / zeromodels.- SAM / SAM2: point coordinates are in original pixel space; box prompts need `enable_boxes=True` / `include_box_input=True` when building the graph.- SAM2 in this port is image-only (no video memory bank).- SAM3: prefer `SAM3InstanceSegment.predict(...)` for text prompts; upstream `facebook/sam3` is gated.- See [SAM3 docs](https://imvision12.github.io/ZeroModels/sam3/) and [Loading Weights](https://imvision12.github.io/ZeroModels/loading_weights/).- Community / upstream safetensors still work via the `hf:` prefix, e.g. `SAM3Model.from_weights("hf:facebook/sam3")`.## Special Thanks
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152{"library_name": "kerasformers","kerasformers_version": "1.2.1","model_module": "kerasformers.models.sam3","model_class": "SAM3Model","variant": "sam3","weights": "model.weights.h5","schema_version": 2,"weight_dtype": "float32","model_type": "sam3","vision_config": {"vit_hidden_size": 1024,"vit_intermediate_size": 4736,"vit_num_hidden_layers": 32,"vit_num_attention_heads": 16,"vit_image_size": 1008,"vit_patch_size": 14,"vit_window_size": 24,"vit_global_attn_indexes": [7,15,23,31],"vit_rope_theta": 10000.0,"vit_pretrain_image_size": 336,"fpn_hidden_size": 256,"fpn_scale_factors": [4.0,2.0,1.0,0.5],"detr_encoder_hidden_size": 256,"detr_encoder_num_layers": 6,"detr_encoder_num_attention_heads": 8,"detr_encoder_intermediate_size": 2048,"detr_encoder_dropout": 0.1,"detr_decoder_hidden_size": 256,"detr_decoder_num_layers": 6,"detr_decoder_num_queries": 200,"detr_decoder_num_attention_heads": 8,"detr_decoder_intermediate_size": 2048,"detr_decoder_dropout": 0.1,"mask_decoder_hidden_size": 256,"mask_decoder_num_upsampling_stages": 3,"mask_decoder_num_attention_heads": 8,"text_hidden_size": 1024,"text_projection_dim": 512,"image_size": 1008}}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152{"library_name": "zeromodels","zeromodels_version": "1.2.1","model_module": "zeromodels.models.sam3","model_class": "SAM3Model","variant": "sam3","weights": "model.weights.h5","schema_version": 2,"weight_dtype": "float32","model_type": "sam3","vision_config": {"vit_hidden_size": 1024,"vit_intermediate_size": 4736,"vit_num_hidden_layers": 32,"vit_num_attention_heads": 16,"vit_image_size": 1008,"vit_patch_size": 14,"vit_window_size": 24,"vit_global_attn_indexes": [7,15,23,31],"vit_rope_theta": 10000.0,"vit_pretrain_image_size": 336,"fpn_hidden_size": 256,"fpn_scale_factors": [4.0,2.0,1.0,0.5],"detr_encoder_hidden_size": 256,"detr_encoder_num_layers": 6,"detr_encoder_num_attention_heads": 8,"detr_encoder_intermediate_size": 2048,"detr_encoder_dropout": 0.1,"detr_decoder_hidden_size": 256,"detr_decoder_num_layers": 6,"detr_decoder_num_queries": 200,"detr_decoder_num_attention_heads": 8,"detr_decoder_intermediate_size": 2048,"detr_decoder_dropout": 0.1,"mask_decoder_hidden_size": 256,"mask_decoder_num_upsampling_stages": 3,"mask_decoder_num_attention_heads": 8,"text_hidden_size": 1024,"text_projection_dim": 512,"image_size": 1008}}
12345678910111213141516171819{"library_name": "kerasformers","kerasformers_version": "1.2.3","preprocessor_module": "kerasformers.models.sam3","preprocessor_class": "SAM3ImageProcessor","variant": "sam3","image_resolution": 1008,"image_mean": [0.5,0.5,0.5],"image_std": [0.5,0.5,0.5],"rescale_factor": 0.00392156862745098}12345678910111213141516171819{"library_name": "zeromodels","zeromodels_version": "1.2.3","preprocessor_module": "zeromodels.models.sam3","preprocessor_class": "SAM3ImageProcessor","variant": "sam3","image_resolution": 1008,"image_mean": [0.5,0.5,0.5],"image_std": [0.5,0.5,0.5],"rescale_factor": 0.00392156862745098}
README.md+18-18
kf_config.json → zm_config.jsonRenamed+51-51
kf_preprocessor.json → zm_preprocessor.jsonRenamed+18-18