1.3 KiB
1.3 KiB
CLAUDE.md — corridorkey-mlx
MLX inference port of CorridorKey for Apple Silicon.
Architecture
- Input: 4ch (RGB + coarse alpha hint)
- Backbone: Hiera (timm, features_only=True) → 4 multiscale features
- Decoder heads: alpha (1ch) + foreground (3ch), upsampled to full res
- Refiner: CNN over RGB + coarse preds (7ch) → additive delta logits → sigmoid
Repo layout
src/corridorkey_mlx/— main packagemodel/— MLX model definitionsconvert/— PyTorch→MLX weight conversioninference/— inference pipelineio/— image loading, saving, preprocessingutils/— shared helpers, layout transforms
scripts/— CLI tools (dump reference, compare, bench)prompts/— phased port instructionsreference/— PyTorch reference harness outputstests/— parity and unit tests
Conventions
- Python 3.12+, uv for deps
- ruff for lint/format, mypy for types, pytest for tests
- MLX uses NHWC — centralize layout transforms in
utils/ - All non-trivial changes need a validation path
- Inference only — no training code
- Preserve PyTorch behavior before optimizing
Commands
uv run pytest # run tests
uv run ruff check . # lint
uv run ruff format . # format
uv run mypy src/ # type check