transformers
678914d8 - Complete PR #49228: remove unused device=None from rope __init__ in 11 model families (#49285)

Commit
3 days ago
Complete PR #49228: remove unused device=None from rope __init__ in 11 model families (#49285) * Complete PR #49228: remove unused device=None from rope __init__ in 11 model families PR #49228 ("Remove rotaries deprecation cycle") removed `device=None` from rope `__init__` signatures in most models (llama, afmoe, bamba, etc.) but missed 11 model families that had custom rope classes. These kept `device=None` in `__init__` while no longer passing it to `rope_init_fn`, causing `test_model_rope_scaling_frequencies` to run (2 params → condition passes) and crash with a device mismatch. Remove `device=None` from the rope `__init__` of: cosmos3_edge, glm4v, glm4v_moe, glm_image, glm_ocr, hunyuan_vl (+ modular), qwen3_5, qwen3_5_moe, qwen3_vl, qwen3_vl_moe, qwen4_exp — making them consistent with every other model updated by PR #49228. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix modular source files: remove device=None from rope __init__ Same fix as the modeling files — remove the unused device=None param from the modular source files so check_modular_conversion.py passes. glm4v_moe, glm_image, glm_ocr, qwen3_5_moe, qwen3_vl_moe, qwen4_exp, and cosmos3_edge inherit this fix transitively from glm4v, qwen3_5, and qwen3_vl respectively. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix qwen3_omni_moe: remove device=None from text rope __init__ qwen3_omni_moe inherits its text rope from qwen3_vl (now fixed), so the generated file no longer has device=None. Align the actual modeling file to match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix test_model_rope_scaling_frequencies to work with config-only rope __init__ - Change `> 1` to `>= 1` in the rope detection condition: the real discriminator is `params[0].name == "config"`; `> 1` was only true while ropes still had `(config, device=None)` as two params - Replace `rope_class(config=..., device=torch_device)` with `rope_class(config=...).to(torch_device)`: ropes no longer accept `device` in __init__; moving buffers via `.to()` is the correct way Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
Author
Parents
Loading