feat(phase4): MLX Hiera backbone port (#2)
* feat(phase4a): MLX Hiera backbone with unroll/reroll parity
Port timm hiera_base_plus_224 to MLX: PatchEmbed, MaskUnitAttention,
HieraBlock, unroll/reroll, HieraBackbone. 4 NHWC feature maps at
strides 4/8/16/32. backbone.py now re-exports from hiera.py.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(phase4c): weight loading + pos_embed bicubic interpolation
HieraBackbone.load_checkpoint() loads safetensors, strips encoder.model.
prefix, bicubic-interpolates pos_embed from 512x512 to 128x128 tokens.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(phase4d): shape + parity tests, fix attention transpose
Fix MaskUnitAttention output transpose (0,2,3,1,4 → 0,3,2,1,4) to
match PyTorch transpose(1,3) token ordering for windowed attention.
Parity results (4 stages):
Stage 0: max_abs 2.9e-4, mean 1.6e-5
Stage 1: max_abs 1.3e-4, mean 1.3e-5
Stage 2: max_abs 1.1e-2, mean 5.2e-5 (16 blocks, expected drift)
Stage 3: max_abs 5.8e-4, mean 2.6e-5
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: clarify pos_embed parameter intent in HieraBackbone
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>