Fix missing num_hidden_layers attribute in T5GemmaConfig#40903
Closed
0xjeffro wants to merge 10 commits intohuggingface:mainfrom
Closed
Fix missing num_hidden_layers attribute in T5GemmaConfig#409030xjeffro wants to merge 10 commits intohuggingface:mainfrom
0xjeffro wants to merge 10 commits intohuggingface:mainfrom
Conversation
This is a quick fix for issue huggingface#40874. The `T5GemmaConfig` class was missing the `num_hidden_layers` attribute that cache initialization expects. Added `attribute_map` and `num_layers` property following the same pattern used by `T5Config` to expose the decoder's `num_hidden_layers` value.
This is a quick fix for issue huggingface#40874. The `T5GemmaConfig` class was missing the `num_hidden_layers` attribute that cache initialization expects. Added `attribute_map` and `num_layers` property following the same pattern used by `T5Config` to expose the decoder's `num_hidden_layers` value.
Collaborator
ArthurZucker
left a comment
There was a problem hiding this comment.
forgot that it was an encoder decoder hahah there might be a better way to fix this @gante I don't remember what we do in that case
This is a quick fix for issue huggingface#40874. The `T5GemmaConfig.get_text_config()` method was always returning self instead of the appropriate sub-configuration. This caused cache initialization failures because the main config lacks `num_hidden_layers` while the decoder/encoder sub-configs have this attribute. Now the method correctly returns the decoder config when `decoder=True` and encoder config when `encoder=True`, allowing `cache_utils.py` to obtain the proper configuration with `num_hidden_layers` for cache initialization.
…_T5GemmaConfig' into fix_missing_num_hidden_layers_in_T5GemmaConfig # Conflicts: # src/transformers/models/t5gemma/configuration_t5gemma.py
This is a quick fix for issue huggingface#40874. The `T5GemmaConfig` class was missing the `num_hidden_layers` attribute that cache initialization expects. Added `num_hidden_layers` property to expose the decoder's `num_hidden_layers` value.
This is a quick fix for issue huggingface#40874. The `T5GemmaConfig` class was missing the `num_hidden_layers` attribute that cache initialization expects. Added `num_hidden_layers` property to expose the decoder's `num_hidden_layers` value.
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: t5gemma |
gante
suggested changes
Sep 17, 2025
Contributor
gante
left a comment
There was a problem hiding this comment.
uhmmm this is not wanted, it means config.get_text_config is not fetching the decoder for this model correctly. Having a look at the original issue
Contributor
|
#40939 is the right fix 🤗 In any case, thank you for being proactive and trying to fix the issue 🫶 |
Contributor
|
(closing the PR so we don't mistakenly merge it) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a quick fix for issue #40874. The
T5GemmaConfigclass was missing thenum_hidden_layersattribute that cache initialization expects. Addednum_hidden_layersproperty to expose the decoder'snum_hidden_layersvalue.What does this PR do?
Fixes #40874
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.