Skip to content

[Cache] Add get_recurrent_state - #49306

Open
remi-or wants to merge 2 commits into
add-is-recordingfrom
add-get-recurrent
Open

remi-or wants to merge 2 commits into
add-is-recordingfrom
add-get-recurrent

Conversation

@remi-or

@remi-or remi-or commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

馃 Transformers CI

As per title

Same logic as #49305 : the way we retrieve recurrent_states right now exposes some cache internals, that would make a PagedAttentionCache crash and using a method is cleaner.
The method checks the layer is a linear attention mixin and the recurrent state is intialized, raising with a comprehensive message if not.

BTW, it seems we only use state_idx = 0, so it might be worth removing if we ever rework that cache.

@remi-or
remi-or requested a review from Cyrilvallez October 5, 2026 04:38
@remi-or
remi-or added this pull request to stack #49307 October 5, 2026 04:38
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@Cyrilvallez Cyrilvallez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just one comment, feel free to disregard if you feel strongly against but IMO probably better to return None when it's not yet initialized

Comment thread src/transformers/cache_utils.py Outdated
@remi-or
remi-or force-pushed the add-get-recurrent branch 4 times, most recently from b976353 to 9cb8375 Compare October 19, 2026 06:05
@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: bamba, falcon_h1, falcon_mamba, glm5_next, granitemoehybrid, jamba, kimi_linear, mamba, mamba2, nemotron_h, olmo_hybrid, qwen3_5, qwen3_5_moe, qwen3_next, qwen4_exp, zamba

@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 39246714690:1
Result: failure | Jobs: 15 | Tests: 203,749 | Failures: 0 | Duration: 15h 47m

This branch has not been deployed

No deployments
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.

3 participants