-
Notifications
You must be signed in to change notification settings - Fork 23
perf: faster batch, correct CUDA numerics #139
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
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
a975fcf to
01e301e
Compare
01e301e to
11b4ccf
Compare
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.
Uses batch execution (and process forking in a ProcessPoolExecutor 🤫 ) to cut down the speed of execution on GPU 🍴
This involved having to use BFGS-B, as it's the only method supported by the JAX in-library shim of
scipy.optimize.minimize(but making it vmappable). So far this has affected the qualityThe effect can be seen more easily if you duplicate the
example_inputdir by copying the files (not sure if this necessarily works in general or it's cheating somehow, but as an initial test it's promising!)Benchmark on 40 images
Previous best to current best: 4.1x faster
Optimisation results
The key fix was enabling float64 (
jax.config.update("jax_enable_x64", True)) and keeping the objective function identical to the original. The vmap L-BFGS now:The float64 was critical because the L-BFGS Hessian approximation accumulates numerical errors that compound over iterations - float32 just doesn't have enough precision for this geometric optimization problem.
Update: x64 enabled, experimental L-BFGS-B, quality now at parity
CPU
GPU