Skip to content
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

[bug] Fix prograss bar is not displayed and updated as expected #683

Merged
merged 3 commits into from
Aug 3, 2024

Conversation

Routhleck
Copy link
Collaborator

jax.pure_callback() may not work as expected for certain use cases, such as updating a progress bar, whereas jax.debug.callback()can be used effectively.

jax.pure_callback() is intended for pure functions without side effects. If JAX determines that the callback's result isn't used in the computation, it might optimize the callback call out, which means updates to a progress bar (a side effect) wouldn't occur.

jax.debug.callback(), on the other hand, does not assume the function is pure and always executes the callback as part of the computation. This consistency ensures that progress bar updates and other side effects happen reliably, even under JAX transformations like jit and vmap.

For more detail, see https://jax.readthedocs.io/en/latest/notebooks/external_callbacks.html

@Routhleck Routhleck added the bug Something isn't working label Aug 3, 2024
@Routhleck
Copy link
Collaborator Author

#682

@Routhleck
Copy link
Collaborator Author

Routhleck commented Aug 3, 2024

The latest JAX update has removed named_shapes. As a result, the _check_shape function in brainpy/_src/math/random.py requires an update for continued compatibility.

Copy link
Collaborator

@chaoming0625 chaoming0625 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work.

@chaoming0625 chaoming0625 merged commit c464025 into master Aug 3, 2024
37 of 38 checks passed
@chaoming0625 chaoming0625 deleted the fix-progress-bar branch August 3, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants