File size: 4,114 Bytes
66f4e01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{
  "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"
    }
  }
}