Skip to content

fix(autojac): Automatically fallback when vmap fails#767

Open
KartavyaDikshit wants to merge 2 commits into
SimplexLab:mainfrom
KartavyaDikshit:fix-issue-699
Open

fix(autojac): Automatically fallback when vmap fails#767
KartavyaDikshit wants to merge 2 commits into
SimplexLab:mainfrom
KartavyaDikshit:fix-issue-699

Conversation

@KartavyaDikshit

Copy link
Copy Markdown

Resolves #699

Fallback to sequential differentiation when torch.vmap encounters limitations such as mixed precision autocast nodes in graph or torch.compile. Emits a helpful warning suggesting explicitly passing parallel_chunk_size=1.

Signed-off-by: KartavyaDikshit kartavyaniraj.dikshit2021@vitstudent.ac.in

@ValerianRey

Copy link
Copy Markdown
Member

Hi, thanks for the PR. This seems like an interesting direction, until we can properly fix the core problem in torch itself. So far, CI breaks though, could you please fix the errors?

@KartavyaDikshit
KartavyaDikshit requested a review from a team as a code owner July 18, 2026 19:45
@ValerianRey

ValerianRey commented Jul 19, 2026

Copy link
Copy Markdown
Member

I'm working on a fix on PyTorch itself. If it succeeds, this workaround won't be needed. I'll update you soon if I manage to make a PR, and if they accept it. But since there are other reasons for which vmap could fail, this is still relevant even if we fix the autocast + vmap + grad combo.

@ValerianRey ValerianRey added package: autojac cc: fix Conventional commit type for bug fixes of the actual library (changes to src). labels Jul 19, 2026
@ValerianRey ValerianRey changed the title fix: automatically fallback to chunk_size=1 when vmap fails fix: automatically fallback when vmap fails Jul 19, 2026
@github-actions github-actions Bot changed the title fix: automatically fallback when vmap fails fix(autojac): Automatically fallback when vmap fails Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: fix Conventional commit type for bug fixes of the actual library (changes to src). package: autojac

Projects

None yet

Development

Successfully merging this pull request may close these issues.

autojac incompatible with AMP for models with normalization layers

2 participants