Bug description
_check_received_keys in modeling_rope_utils.py (line 919) performs received_keys -= ignore_keys where received_keys is a set but ignore_keys can be a list after JSON deserialization, causing:
TypeError: unsupported operand type(s) for -=: 'set' and 'list'
Root cause
Model configs like Qwen3.5 define ignore_keys_at_rope_validation = {"mrope_section", "mrope_interleaved"} as a Python set. However, JSON has no set type — when the config is serialized to JSON and loaded back (e.g. via huggingface_hub dataclass validation), sets become lists. The _check_received_keys method doesn't account for this.
Reproduction
# transformers==5.4.0, huggingface_hub>=1.7
from transformers import AutoConfig
# Works fine (loads from Python class):
config = AutoConfig.from_pretrained("Qwen/Qwen3.5-35B-A3B")
# Fails when loaded via huggingface_hub strict dataclass validation
# (e.g. through vLLM which triggers this path):
# 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.
Affected models
Any model defining ignore_keys_at_rope_validation: Qwen3.5, ErnieVLMoe, GLM4V, Ministral3, etc.
Fix
# src/transformers/modeling_rope_utils.py, line 919
- received_keys -= ignore_keys
+ received_keys -= set(ignore_keys)
set() is a no-op when input is already a set, and correctly handles the list case.
Environment
- transformers 5.4.0
- huggingface_hub 1.7.2 / 1.8.0
- vLLM 0.18.0
- Python 3.13
Bug description
_check_received_keysinmodeling_rope_utils.py(line 919) performsreceived_keys -= ignore_keyswherereceived_keysis asetbutignore_keyscan be alistafter JSON deserialization, causing:Root cause
Model configs like Qwen3.5 define
ignore_keys_at_rope_validation = {"mrope_section", "mrope_interleaved"}as a Python set. However, JSON has no set type — when the config is serialized to JSON and loaded back (e.g. viahuggingface_hubdataclass validation), sets become lists. The_check_received_keysmethod doesn't account for this.Reproduction
Triggered by vLLM 0.18.0 serving Qwen/Qwen3.5-35B-A3B.
Affected models
Any model defining
ignore_keys_at_rope_validation: Qwen3.5, ErnieVLMoe, GLM4V, Ministral3, etc.Fix
set()is a no-op when input is already a set, and correctly handles the list case.Environment