-
Notifications
You must be signed in to change notification settings - Fork 185
CVXPYlayers 1.0 #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
CVXPYlayers 1.0 #184
Conversation
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
pre-commit with ruff
pre-commit with ruff - Add 22 unit tests for parse_args.py covering VariableRecovery, LayersContext, and parse_args - Add type annotations to parse_args.py (return types, proper Optional types) - Configure ruff following cvxpy's pragmatic approach (E, F, I rules only, 100 char line length) - Enable PT (pytest-style) rules for tests with proper match parameters - Fix all PT011/PT012 violations in existing tests - Add .pre-commit-config.yaml with ruff linter/formatter - Exclude mpax_if.py temporarily (TODO: fix separately)
- Add 22 unit tests for parse_args.py with full coverage of edge cases - Add proper type annotations to parse_args.py - Configure ruff following cvxpy's pragmatic approach (100 char lines, E/F/I rules) - Enable PT (pytest-style) rules and fix all 13 violations in existing tests - Enable pyright type checker (scoped to new files only for incremental adoption) - Fix type issues: solver parameter accepts None, q can be None - Exclude mpax_if.py from ruff temporarily - Add pre-commit hooks: ruff, pyright, standard file checks
* fixing tests * working on batching * batching works * fixed tests * get CI passing * install cvxpy from mater in CI * up CI to ptyhon 3.12
Adds jax interface mirroring torch interface
Add GP support
- Remove ~160 lines of dead code: - _MxTrackedArray class (unused numpy subclass) - _mx_numpy_array, _mx_numpy_eye, _mx_numpy_solve (never called) - _patch_mx_grad and _reduce_to_scalar (global mx.grad monkey-patching) - Unused _original_* variables and restore statements - Align structure with torch/jax implementations: - Same helper functions with consistent docstrings - Rename _scipy_csr_to_numpy_array -> _scipy_csr_to_dense - Rename _solve_canonical -> _solve_with_vjp - Use mx.broadcast_to instead of custom _expand_unbatched_param - Fix tests to use mx.grad correctly: - Add argnums=(0,1) for multi-arg gradients - Ensure scalar return values 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Apple MLX tensors support (refactor according to code of other frameworks of cvxpylayers1.0 )
* loosening dependencies * bump to python 3.10 * minimize delta
* initial work; not finished--saving progress * more work; almost finished with cuclarabel first pass * done? saving progress. now to test * cleaning up * bugfixes * working status * Various fixes for diffqcp * quad obj is None handling * bugfixes + consolidate cuclarabel * remove old cuclarabel * cleaning up before opening PR * more cleaning * re-add lock file * addressing PR comments * make cuclarabel test use double precision * let there be doubles --------- Co-authored-by: Parth Nobel <parthnobel@berkeley.edu>
* Adds shape tests * Rewrites tests
* adds Jax 0.6.0 support * fixed uv sycn * minor fixes * Clean rewrite of Moreau interface with zero-copy GPU tensors - Use moreau_torch for PyTorch path (zero-copy GPU operations) - Remove diffqcp/cupy dependencies - gradients raise NotImplementedError - Create solver once in MOREAU_ctx with dynamic batch size - torch_to_data handles GPU tensor prep using torch indexing - Split into MOREAU_data (torch) and MOREAU_data_jax classes - Add test for backward NotImplementedError 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * caching solver in cvxpylayers * update moreau interface * Add CPU support to moreau interface - Replace hard-coded .cuda() calls with device-aware .to(device, dtype) - Add get_cpu_solver() for numpy-based moreau.Solver on CPU tensors - CUDA path: zero-copy GPU operations with moreau.TorchSolver - CPU path: zero-copy torch<->numpy conversion with moreau.Solver - Add CPU-specific tests (equality, mixed constraints, batched) - Add device consistency tests (output matches input device) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * align moreau interface with new API * cleaned up depedencies * update moreau API * support settings * Alternate CuClarabel+diffqcp implementation (#182) * initial work; not finished--saving progress * more work; almost finished with cuclarabel first pass * done? saving progress. now to test * cleaning up * bugfixes * working status * Various fixes for diffqcp * quad obj is None handling * bugfixes + consolidate cuclarabel * remove old cuclarabel * cleaning up before opening PR * more cleaning * re-add lock file * addressing PR comments * make cuclarabel test use double precision * let there be doubles --------- Co-authored-by: Parth Nobel <parthnobel@berkeley.edu> * Formats cuclarabel_conif.py * Adds shape tests (#185) * Adds shape tests * Rewrites tests * Adds torch example * Adds jax_example * Updates README.md * SPEC0 alignment in Python versioning --------- Co-authored-by: Steven Diamond <diamond.po.central@gmail.com> Co-authored-by: Claude <noreply@anthropic.com>
* first attempt at fixes * depedency stuff * small fix + readme * switch to lsmr default diffqcp
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.
No description provided.