transformers - 💡(How to fix) Fix [BUG] Gemma-4 Gemma4AudioRelPositionalEncoding [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
huggingface/transformers#45468Fetched 2026-04-17 08:26:42
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
0
Author
Participants
Timeline (top)
mentioned ×3subscribed ×3commented ×1labeled ×1
RAW_BUFFERClick to expand / collapse

System Info

N/A.

Who can help?

The hard coded numbers 12 and -1 seem to be related to attention_context_left and attention_context_right.

https://github.com/huggingface/transformers/blob/8426e7e63d49d9c3b5f0c09d43e792a59c75c62c/src/transformers/models/gemma4/modular_gemma4.py#L160

@eustlb @ebezzam @vasqu

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

Code review.

Expected behavior

Use params from config.

extent analysis

TL;DR

The issue may be resolved by using the parameters from the config instead of hard-coded numbers for attention_context_left and attention_context_right.

Guidance

  • Review the config file to identify the correct parameters for attention_context_left and attention_context_right.
  • Update the code to use these parameters instead of the hard-coded values 12 and -1.
  • Verify that the updated code behaves as expected by running the official example scripts or the modified scripts.

Example

No example code is provided due to lack of specific details about the config file and the code that needs to be updated.

Notes

The solution assumes that the config file contains the correct parameters for attention_context_left and attention_context_right. If the config file does not contain these parameters, additional investigation may be needed to determine the correct values.

Recommendation

Apply workaround: Update the code to use parameters from the config file instead of hard-coded numbers, as this approach is more flexible and maintainable.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Use params from config.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING