Skip to content

Fix TypeError in rope validation when ignore_keys is a list#45069

Merged
Rocketknight1 merged 1 commit intohuggingface:mainfrom
Fr0do:fix/rope-validation-set-list
Mar 30, 2026
Merged

Fix TypeError in rope validation when ignore_keys is a list#45069
Rocketknight1 merged 1 commit intohuggingface:mainfrom
Fr0do:fix/rope-validation-set-list

Conversation

@Fr0do
Copy link
Copy Markdown
Contributor

@Fr0do Fr0do commented Mar 27, 2026

What does this PR do?

Fixes a TypeError in _check_received_keys (line 919 of modeling_rope_utils.py) where received_keys -= ignore_keys fails when ignore_keys is a list instead of a set.

Root cause

Model configs (Qwen3.5, ErnieVLMoe, GLM4V, Ministral3) define ignore_keys_at_rope_validation as a Python set. JSON has no set type, so when configs are serialized/deserialized (e.g. via huggingface_hub strict dataclass validation), sets become lists. The -= operator on set doesn't accept list operands.

Fix

- received_keys -= ignore_keys
+ received_keys -= set(ignore_keys)

set() is a no-op for set inputs and correctly converts lists.

Error

huggingface_hub.errors.StrictDataclassClassValidationError: 
  Class validation error for validator 'validate_rope':
    TypeError: unsupported operand type(s) for -=: 'set' and 'list'

Triggered by vLLM 0.18.0 serving Qwen/Qwen3.5-35B-A3B.

Fixes #45068

`_check_received_keys` performs `received_keys -= ignore_keys` where
`received_keys` is a `set`. When model configs are loaded from JSON
(e.g. via huggingface_hub dataclass validation), sets get deserialized
as lists since JSON has no set type, causing:

    TypeError: unsupported operand type(s) for -=: 'set' and 'list'

Wrapping with `set()` handles both cases (no-op for sets, converts lists).

Fixes huggingface#45068
Copy link
Copy Markdown
Member

@Rocketknight1 Rocketknight1 left a comment

Choose a reason for hiding this comment

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

Makes sense to me, and should be safe!

@Rocketknight1 Rocketknight1 enabled auto-merge March 30, 2026 11:15
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

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.

@Rocketknight1 Rocketknight1 added this pull request to the merge queue Mar 30, 2026
Merged via the queue into huggingface:main with commit 02063e6 Mar 30, 2026
30 checks passed
NielsRogge pushed a commit to NielsRogge/transformers that referenced this pull request Mar 30, 2026
…ace#45069)

`_check_received_keys` performs `received_keys -= ignore_keys` where
`received_keys` is a `set`. When model configs are loaded from JSON
(e.g. via huggingface_hub dataclass validation), sets get deserialized
as lists since JSON has no set type, causing:

    TypeError: unsupported operand type(s) for -=: 'set' and 'list'

Wrapping with `set()` handles both cases (no-op for sets, converts lists).

Fixes huggingface#45068

Co-authored-by: IrinaArmstrong <a.irene.a@mail.ru>
SangbumChoi pushed a commit to SangbumChoi/transformers that referenced this pull request Apr 4, 2026
…ace#45069)

`_check_received_keys` performs `received_keys -= ignore_keys` where
`received_keys` is a `set`. When model configs are loaded from JSON
(e.g. via huggingface_hub dataclass validation), sets get deserialized
as lists since JSON has no set type, causing:

    TypeError: unsupported operand type(s) for -=: 'set' and 'list'

Wrapping with `set()` handles both cases (no-op for sets, converts lists).

Fixes huggingface#45068

Co-authored-by: IrinaArmstrong <a.irene.a@mail.ru>
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.

TypeError in rope validation: set -= list when config loaded from JSON

4 participants