(fix) Fetch referenced config on models that require it#38
Merged
alvarobartt merged 3 commits intoalvarobartt:mainfrom Mar 5, 2026
Merged
(fix) Fetch referenced config on models that require it#38alvarobartt merged 3 commits intoalvarobartt:mainfrom
alvarobartt merged 3 commits intoalvarobartt:mainfrom
Conversation
alvarobartt
approved these changes
Mar 2, 2026
Owner
alvarobartt
left a comment
There was a problem hiding this comment.
Thanks @Napuh I've left a nit with that I think we can merge 🤗
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.
Description
Some models, like llava-hf/llava-1.5-7b-hf have the necessary config to calculate the KV cache size referenced to other models. For example:
Estimating the memory requirements for this model with the
--experimentalflag for KV-cache size estimation, throws and error:TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'This PR allows to fetch the referenced config, and use those values to estimate the KV-cache size. If the
_name_or_pathkey is present intext_config, it uses those values as a base for LLM parameters (num_hidden_layers, hidden_size, etc.), and then overwrites with values from the original text_config (like max_position_embeddings, which may have been modified)Before this PR,
...ForConditionalGenerationmodels with referenced configs failed to calculate the KV-cache size:After this PR, the command executes succesfully.
CONTRIBUTING.md.