Skip to content

Conversation

@hmellor
Copy link
Member

@hmellor hmellor commented Dec 5, 2025

set(rope_parameters.keys()).issubset(self.layer_types) will evaluate to True if rope_parameters is an empty dict.

This is a problem if standardise_rope_params is called on a config for a model which do not have RoPE because it will trigger Case 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_params harmless to call on configs with no RoPE at all.

…to put in it

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@HuggingFaceDocBuilderDev

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.

@hmellor hmellor requested a review from zucchini-nlp December 5, 2025 12:25
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):
Copy link
Member

Choose a reason for hiding this comment

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

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

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>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Copy link
Member

@zucchini-nlp zucchini-nlp left a comment

Choose a reason for hiding this comment

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

Perfect

@hmellor hmellor enabled auto-merge (squash) December 6, 2025 10:53
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