transformers
c2622a9e - Make LongcatFlashConfig self-consistent without building the model (#48899)

Commit
9 days ago
Make LongcatFlashConfig self-consistent without building the model (#48899) * Make LongcatFlashConfig self-consistent without building the model `LongcatFlashModel.__init__` patched `config.num_hidden_layers = 2 * config.num_layers` at model construction time, so anything reading the config on its own saw the static default of 56. LongCat checkpoints ship `num_layers` and no `num_hidden_layers`, so `LongcatFlashConfig(num_layers=14)` returned 56 rather than 28. Derive it in `__post_init__` instead and drop the patch from the model. Also map `moe_intermediate_size` to `expert_ffn_hidden_size` in `attribute_map`, the name the other 39 MoE configs use and the remap the modular file already notes in a comment. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> * revert tests Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> * use property Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> --------- Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
Parents
Loading