Add experimental Rust backend adapter#1242
Draft
gustavorubim wants to merge 1 commit into
Draft
Conversation
Author
Fresh-env benchmark smokeI ran a fresh virtualenv benchmark to verify the PySR Rust backend adapter against the Julia backend across 10 generated target equations. Setup:
Cold fresh-env pass:
Warm pass after Julia deps/precompile:
Notes:
|
847fead to
6e81ca0
Compare
Member
|
Small initial comments:
|
6e81ca0 to
7450bd7
Compare
Author
|
Updated this PR in response to the initial feedback:
Validation rerun:
|
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.
Summary
Adds an experimental
backend=rustpath plus defaultbackend=autoselection to PySR.backend=autouses the optional Rust backend when thesymbolic_regression_rsmodule frompysr-rust-backendis installed, otherwise it falls back to the full Julia backend.This PR intentionally does not vendor the Rust workspace into PySR. It depends on the Python wrapper package from astroautomata/symbolic_regression.rs being released as
pysr-rust-backend>=0.1.0,<0.2.0.What changed
PySRRegressor(backend=auto | julia | rust)and route Rust searches throughpysr.backends.rust.from pysr import PySRRegressordoes not initializejuliacall.pysr[rust]optional dependency metadata forpysr-rust-backend.symbolic_regression_rsis installed.Follow-up to review comments
backend=auto, as suggested, so installing the Rust backend selects Rust unlessbackend=juliais set explicitly.pysr-rust-backend, propagateseed, reject unknown options, validate operator arity, document unsupported features, and smoke-test publish wheels.Validation
python -m pysr test main,jax,torch,autodiff,cli,dev,startup,slurm,rustwith the Rust wrapper uninstalled: 143 tests passed, 5 skipped.python -m pysr test rustwith localpysr-rust-backendinstalled: 14 tests passed.python -m mypy --ignore-missing-imports pysrpython -m compileall -q pysr benchmarks/compare_backends.pybenchmarks/compare_backends.pysmoke run for Julia and Rust: Julia 18.547s, Rust 0.016s on the small one-repeat fixture.Dependencies
pysr-rust-backendpackage that exposes thesymbolic_regression_rsmodule.Known blocker
pysr-rust-backendis not visible on PyPI yet. This should stay draft until the wrapper package is merged/released or until maintainers choose the in-repo connector design.