From f8edbec92316204cc2d96eb19c7eb869573cc3ce Mon Sep 17 00:00:00 2001 From: Will Lin Date: Sun, 5 Jul 2026 04:56:53 +0000 Subject: [PATCH] [bugfix]: raise on unknown rope types in custom qwen2.5-vl encoder The transformers-5.x compat fallback rescued every rope_type missing from ROPE_INIT_FUNCTIONS, silently computing unscaled default frequencies for typo'd or future scaling types; only 'default' (removed from the table in transformers>=5) falls back now, anything else raises KeyError. Co-Authored-By: Claude Fable 5 --- fastvideo/models/encoders/qwen2_5_vl_custom.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fastvideo/models/encoders/qwen2_5_vl_custom.py b/fastvideo/models/encoders/qwen2_5_vl_custom.py index b4d5aff00..61fadec85 100644 --- a/fastvideo/models/encoders/qwen2_5_vl_custom.py +++ b/fastvideo/models/encoders/qwen2_5_vl_custom.py @@ -491,7 +491,14 @@ class Qwen2_5_VLRotaryEmbedding(nn.Module): self.original_max_seq_len = config.max_position_embeddings self.config = config - self.rope_init_fn = ROPE_INIT_FUNCTIONS.get(self.rope_type, _compute_default_rope_parameters) + if self.rope_type in ROPE_INIT_FUNCTIONS: + self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type] + elif self.rope_type == "default": + # transformers>=5 drops the "default" entry from ROPE_INIT_FUNCTIONS. + self.rope_init_fn = _compute_default_rope_parameters + else: + raise KeyError(f"Unsupported rope_type '{self.rope_type}'; available: " + f"{['default', *ROPE_INIT_FUNCTIONS]}") inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device) self.register_buffer("inv_freq", inv_freq, persistent=False)