Only default rope_parameters to empty dict if there is something to put in it#42651
Merged
ArthurZucker merged 6 commits intohuggingface:mainfrom Dec 10, 2025
Merged
Conversation
…to put in it Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
|
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. |
zucchini-nlp
reviewed
Dec 5, 2025
| return | ||
| # Case 1: RoPE param keys do not intersect with possible `layer_types` -> one global dict | ||
| if getattr(self, "layer_types", None) is None or not set(rope_parameters.keys()).issubset(self.layer_types): | ||
| elif getattr(self, "layer_types", None) is None or not set(rope_parameters.keys()).issubset(self.layer_types): |
Member
There was a problem hiding this comment.
If the custom model has no rope parameters (i.e. it is {}), we will get triggered by the original issue of evaluting to True, no?
Member
Author
There was a problem hiding this comment.
You're right that if rope_parameters is explicitly set to {} we'll still get here. But if rope_parameters is unset, it will remain None and this method will exit early with a warning
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
zucchini-nlp
reviewed
Dec 5, 2025
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Contributor
|
View the CircleCI Test Summary for this PR: https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=42651&sha=d58675 |
SangbumChoi
pushed a commit
to SangbumChoi/transformers
that referenced
this pull request
Jan 23, 2026
…to put in it (huggingface#42651) * Only default `rope_parameters` to empty `dict` if there is something to put in it Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> * Add warning Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> * Also catch explicit `{}` Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> * Handle model with layer types and rope theta but not rope parameters Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> --------- Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
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.
set(rope_parameters.keys()).issubset(self.layer_types)will evaluate toTrueifrope_parametersis an emptydict.This is a problem if
standardise_rope_paramsis called on a config for a model which do not have RoPE because it will triggerCase 2. This method might be called on models which do not have RoPE in third party libraries (e.g. vLLM) in order to "upgrade" configs of custom models they use.This PR makes
standardise_rope_paramsharmless to call on configs with no RoPE at all.