cmoyates
57c3aff913
feat(phase6): optimization, benchmarking, and tiled inference
...
- Cache nn.Upsample instances in DecoderHead/GreenFormer __init__
(eliminated ~7 allocations per forward pass)
- Add mx.compile() support via load_model(compile=True)
- Benchmark harness: eager vs compiled, multi-resolution, parity checks
- Tiled inference with overlap blending for large images
- Profiling utilities with forced mx.eval for accurate timing
- Reference comparison script (scripts/compare_reference.py)
- 12 new tests (compiled consistency + tiling)
- README performance section with Apple Silicon guidance
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 06:24:10 -03:30
cmoyates
0481955cfd
feat(phase5): full model assembly + e2e parity
...
Wire GreenFormer (backbone + decoders + refiner), add image I/O,
inference pipeline, CLI entry point, and 3 test files (23 new tests).
E2e parity vs PyTorch: max abs err < 1.5e-4 across all outputs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 06:07:43 -03:30
Cristopher Yates
c2e7967538
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>
2026-03-01 05:55:24 -03:30
Cristopher Yates
150c974eed
feat(phase3): PyTorch→MLX weight converter ( #1 )
...
* feat(phase3): PyTorch→MLX weight converter + safetensors output
365 keys mapped (367 source - 2 num_batches_tracked skipped).
Conv weights transposed (O,I,H,W→O,H,W,I), refiner stem remapped,
4ch patch embed preserved. 12 conversion tests + diagnostic report.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(phase3): conv allowlist, unused var, test fixture
- Replace _is_conv_weight heuristic with explicit CONV_WEIGHT_KEYS frozenset (15 keys)
- Remove unused `skipped` list from convert_state_dict
- Module-scoped pytest fixture eliminates 11 redundant checkpoint loads
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 05:16:56 -03:30
cmoyates
091261ccff
feat(phase2): MLX decoder + refiner with parity tests
...
- MLP, DecoderHead (SegFormer-style), RefinerBlock, CNNRefinerModule
- All NHWC native, GroupNorm with pytorch_compatible=True
- Layout utils: NCHW<->NHWC, conv weight transpose (OIHW->OHWI)
- Dump script extended to export decoder/refiner weights
- Parity: decoder max_abs ~5e-6, refiner max_abs ~1e-5
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 05:00:00 -03:30
cmoyates
897242d200
init: repo scaffolding, deps, prompts, plan
...
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 04:48:51 -03:30