{ "mic": "0.3", "name": "SAM2 promptable image segmentation", "usage": "Sam2Model + Sam2Processor, point-prompted segmentation of synthetic images, one fine-tuning step with a user-side BCE mask loss", "architecture": "Sam2Model", "checkpoints": { "facebook/sam2.1-hiera-tiny": { "fixture": "huggingface-mic/sam2.1-hiera-tiny-mic" } }, "fixtures": { "huggingface-mic/sam2.1-hiera-tiny-mic": { "built_from": "facebook/sam2.1-hiera-tiny", "covers": [ "facebook/sam2.1-hiera-tiny" ], "build": { "seed": 17, "model_class": "Sam2Model", "config_overrides": { "fields": { "vision_config.backbone_config.hidden_size": 32, "vision_config.backbone_config.embed_dim_per_stage": [ 32, 64, 128, 256 ], "vision_config.backbone_config.blocks_per_stage": [ 1, 1, 2, 1 ], "vision_config.backbone_config.global_attention_blocks": [ 3 ], "vision_config.backbone_channel_list": [ 256, 128, 64, 32 ], "vision_config.fpn_hidden_size": 128, "mask_decoder_config.hidden_size": 128, "mask_decoder_config.mlp_dim": 256, "mask_decoder_config.iou_head_hidden_dim": 128, "prompt_encoder_config.hidden_size": 128 }, "reason": "The generic shrink leaves SAM2 inconsistent: Hiera hidden_size=64 vs embed_dim_per_stage[0]=96 (stage-0 LayerNorm fails), and the mask decoder/prompt encoder at 64 vs the FPN at 256. Shrink the Hiera stages together (32..256, backbone_channel_list reversed; one global block mid-stage since global blocks have window_size 0 and fail at query-pool boundaries) and use one width of 128 for the FPN, mask decoder and prompt encoder. The checkpoint's video-memory fields are unused by Sam2Model and left as shrunk." }, "accept_insensitive": { "pixel_values:swap_channels": "Reviewed 2026-10-27: the 1.9M-parameter Hiera fixture, overfit on two images, separates them by object position (roll_batch and flip move outputs by 1.7) but not by colour; channel swap moves it <1e-5 for random and overfit weights. The real checkpoint moves pred_masks by 2.6-23 under the same perturbation, so the checkpoint target keeps colour coverage.", "pixel_values:halve": "Reviewed 2026-10-27: same fixture, intensity halving moves outputs <1e-6 for random and overfit weights (position, not brightness, is what two training images teach a fixture this size). The real checkpoint moves pred_masks by 2.6-23, so the checkpoint target keeps intensity coverage." } } } }, "integrations": { "transformers": { "entry_point": "integrations/transformers/usage.md", "format": "runnable-markdown", "requires": [ "transformers>=5", "torch", "Pillow", "numpy" ], "targets": [ "fixtures", "checkpoints" ], "variants": { "default": {}, "eager": { "attn_implementation": "eager" }, "bfloat16": { "dtype": "bfloat16" } }, "training": true, "resources": { "fixture": { "memory_gb": 3, "download_mb": 10 }, "facebook/sam2.1-hiera-tiny": { "memory_gb": 6, "download_mb": 160 } } } }, "outputs": { "runtime": { "compare": "exact" }, "pred_masks": { "compare": "allclose", "atol": 0.0001, "rtol": 0.0001 }, "iou_scores": { "compare": "allclose", "atol": 0.0001, "rtol": 0.0001 }, "training.loss": { "compare": "allclose", "atol": 0.0001, "rtol": 0.0001 }, "training.gradients": { "compare": "all_true" }, "training.updated": { "compare": "true" } } }