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

Unnecessary computation in soft_vmap() #1986

Open
tare opened this issue Feb 20, 2025 · 0 comments
Open

Unnecessary computation in soft_vmap() #1986

tare opened this issue Feb 20, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@tare
Copy link
Contributor

tare commented Feb 20, 2025

Bug Description

I was confused why the map branch was executed

ys = lax.map(fn, xs) if num_chunks > 1 else fn(xs)

when I passed parallel=True to Predictive().

It looks like in that case num_chunks == 2 (should be 1) because pad == chunk_size (should be 0) even though batch_size % chunk_size == 0. This is the line that causes extra padding:

pad = chunk_size - (batch_size % chunk_size)

Please let me know whether my reasoning makes sense.

This commit fixes the issue.

Steps to Reproduce

N/A

Expected Behavior

No padding when batch_size % chunk_size == 0.

@tare tare added the bug Something isn't working label Feb 20, 2025
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

No branches or pull requests

1 participant