Skip to content

[executorch] Update pytree registration for DynamicCache#41901

Open
justinchuby wants to merge 3 commits intohuggingface:mainfrom
justinchuby:justinchuby/dynamic-cache
Open

[executorch] Update pytree registration for DynamicCache#41901
justinchuby wants to merge 3 commits intohuggingface:mainfrom
justinchuby:justinchuby/dynamic-cache

Conversation

@justinchuby
Copy link
Copy Markdown
Contributor

@justinchuby justinchuby commented Oct 27, 2025

What does this PR do?

Update pytree registration for DynamicCache. Before this change the cache values are flatten as (key0, key1, ..., value0, value1, ...). This change matches the old cache interface by flattening to (key0, value0, key1, value1, ...). This ordering matches transformers conversion and is consistent with expectation of downstream tools when they see ky caches.

The change is BC breaking in that it will change the signature of the exporter program. But this is ok since (1) there is going to be transformers 5.0 (2) executorch doesn't rely on this api. Only ONNX does at this point. (3) the original implementation was wrong (pytorch/pytorch#165395)

Also fixes pytorch/pytorch#165395.

cc @titaiwangms @xadupre @jackzhxng @tugsbayasgalan

Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
@justinchuby justinchuby marked this pull request as draft October 27, 2025 18:41
@Rocketknight1
Copy link
Copy Markdown
Member

cc @gante for cache as well

@justinchuby justinchuby marked this pull request as ready for review January 22, 2026 20:29
@github-actions github-actions Bot requested review from MekkCyber and SunMarc January 22, 2026 20:29
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[export] run_decompositions fails with index error

2 participants