Skip to content

Commit c185d30

Browse files
ydshiehclaude
andcommitted
fix(create_dummy_models): skip primitive attributes ending in _config in _get_exact_config
PR #45333 added `serialize_explicit_per_layer_config: bool = False` to PreTrainedConfig base class. Its name ends in `_config`, so the dir() scan in `_get_exact_config` picks it up and tries to recurse into the `False` value, crashing with `AttributeError: 'bool' object has no attribute 'to_dict'` (affects Qwen3_5Config and any other config that inherits the attribute). Skip any sub_config that is neither a dict nor has a `to_dict` method, i.e. plain primitives that happen to have a `_config`-suffixed name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 51a517d commit c185d30

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎utils/create_dummy_models.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,10 @@ def _get_exact_config(_config, config_class):
543543
for key in keys:
544544
sub_config = getattr(_config, key) if not isinstance(_config, dict) else _config[key]
545545
if sub_config is not None:
546+
# Skip primitives (bool, int, str, …) that happen to have a name ending in `_config`
547+
# (e.g. `serialize_explicit_per_layer_config` on PreTrainedConfig is a bool).
548+
if not (isinstance(sub_config, dict) or hasattr(sub_config, "to_dict")):
549+
continue
546550
# TODO: `VibeVoiceAcousticTokenizerEncoder/DecoderConfig` needs some protection!!!
547551
if sub_config.__class__ == _config.__class__:
548552
continue

0 commit comments

Comments
 (0)