Fix: MPS compatibility issues and invalid demosaic method#94
Merged
singer-yang merged 5 commits intovccimaging:mainfrom Dec 31, 2025
Merged
Fix: MPS compatibility issues and invalid demosaic method#94singer-yang merged 5 commits intovccimaging:mainfrom
singer-yang merged 5 commits intovccimaging:mainfrom
Conversation
- The Demosaic class only supports 'bilinear' and 'malvar' methods - Changed to 'malvar' for higher quality demosaicing - This fixes the error when initializing InvertibleISP
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes two compatibility issues in the DeepLens library: an invalid demosaic method parameter and missing MPS device support for a linear algebra operation.
- Corrected invalid demosaic method from '3x3' to 'malvar' in the InvertibleISP pipeline
- Added CPU fallback for torch.linalg.lstsq operation when running on MPS devices
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| deeplens/sensor/isp.py | Fixed bug by changing demosaic method from unsupported '3x3' to valid 'malvar' method |
| deeplens/geolens.py | Added try-except block to handle MPS device limitation for lstsq operation with CPU fallback |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Change invalid demosaic method from '3x3' to 'malvar'
The Demosaic class only supports 'bilinear' and 'malvar' methods.
Fix: Add CPU fallback for torch.linalg.lstsq on MPS device
The aten::linalg_lstsq.out operator is currently not implemented for the MPS device in PyTorch.Added a try-except block in geolens.py to automatically fallback to CPU for this specific calculation.
Note
Compatibility and correctness fixes
deeplens/geolens.py,compute_intersection_points_2dnow falls back to CPU fortorch.linalg.lstsqwhen running on MPS (A.device.type == "mps"), then moves results back to the original device.deeplens/sensor/isp.py, updatesInvertibleISPto use a validDemosaicmethod"malvar"instead of the unsupported"3x3".Written by Cursor Bugbot for commit 1595451. This will update automatically on new commits. Configure here.