Repository navigation
Address PR #28 review: NG backend polish + doc coherence - #33
neuromechanist merged 4 commits into
Conversation
AMICA(backend='ng') auto-selected MPS but AMICATorchNG defaults to float64 (Fortran parity), which MPS rejects; the default config crashed on Apple Silicon. Fall back to CPU when MPS is auto-selected for a float64 NG run. Re-export AMICATorchNG, note it in the model_ docstring, and add a real-data wrapper test (guards, save/load, device fallback). Refs #29.
Silent-failure-hunter: emit the MPS->CPU downgrade via logger.warning unconditionally (not just verbose print), matching the codebase's device caveats; derive AMICATorchNG's default dtype from its signature instead of duplicating the float64 literal; document the fallback on the device parameter. Test-analyzer: add explicit device='mps'+float64 raise test (no MPS needed) and the dtype=float32 MPS escape-hatch test (skipif), and assert the fallback warning fires even with verbose=False.
Review (pr-review-toolkit, model=sonnet)Three reviewers ran against commits code-reviewer: No findings at confidence >= 80. Verified the MPS->CPU fallback on real MPS hardware with real sample data; confirmed explicit silent-failure-hunter:
pr-test-analyzer:
Suite: 63 passed, 2 xfailed (0 failures); |
Closes #29. Applies the PR #28 (epic close-out) review findings into the epic so #28 carries them.
Important
AMICA(backend="ng")crashing on its own default config on Apple Silicon:fit()auto-selected MPS, but
AMICATorchNGdefaults to float64 (Fortran parity), which MPS rejects.When the device is not pinned and resolves to MPS for a float64 NG run, fall back to CPU (CUDA is
unaffected). Users can still opt into MPS with
dtype=torch.float32, device="mps".backend="ng"(test_amica_ng_wrapper.py): constructor guard,debug/output_dir guards, save/load
NotImplementedError, the MPS->CPU device fallback, and asmall real-data fit + transform/get_mixing/get_unmixing. No synthetic data.
Doc coherence
amica_torch_ng.py/AMICATorchNG; UV migration markedcomplete (matches
pyproject.toml/uv.lock/plan.md); follow-ups linked.0001accepted (+ README index) with an outcome note (issue Verify NG init-basin vs Newton bit-parity via Fortran load_* init-matching #24 parity result).FEATURE_PARITY.md/PROGRESS_SUMMARY.md: replaced stale pre-epic metrics (~0.78 corr, ~13xLL) with the NG parity numbers (LL ~ -3.40, corr ~0.997); the "PyTorch" column is flagged as the
pre-epic basic backend.
epic #9xfail reasons to concrete issues (Legacy CLI save/load format mismatch (.npy vs Fortran binary) #30 legacy CLI save/load, GaussianMixtureICA.fit_em log-likelihood decreases across iterations #31legacy mixture M-step).
Suggestions
AMICATorchNGfrompyAMICA/__init__.py; docstringmodel_notes both backends.Follow-up issues filed
mixture M-step, Remove parked AMICATorchV2 and promote backend='ng' to default #32 remove parked
AMICATorchV2+ promotebackend="ng"to default.Test plan
uv run pytest pyAMICA/tests -m "not slow"-> 61 passed, 2 xfailedruff check/ruff formatclean