Skip to content

Commit

Permalink
[Bugfix] Handle conflicts between modern and legacy fields (vllm-proj…
Browse files Browse the repository at this point in the history
…ect#10471)

Signed-off-by: DarkLight1337 <[email protected]>
Signed-off-by: Tyler Michael Smith <[email protected]>
  • Loading branch information
DarkLight1337 authored and tlrmchlsmth committed Nov 23, 2024
1 parent 958f4f1 commit 902a4bc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions vllm/transformers_utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ def patch_rope_scaling(config: PretrainedConfig) -> None:


def patch_rope_scaling_dict(rope_scaling: Dict[str, Any]) -> None:
if "rope_type" in rope_scaling and "type" in rope_scaling:
rope_type = rope_scaling["rope_type"]
rope_type_legacy = rope_scaling["type"]
if rope_type != rope_type_legacy:
raise ValueError(
f"Found conflicts between 'rope_type={rope_type}' (modern "
f"field) and 'type={rope_type_legacy}' (legacy field). "
"You should only specify one of them.")

if "rope_type" not in rope_scaling and "type" in rope_scaling:
rope_scaling["rope_type"] = rope_scaling["type"]
logger.info("Replacing legacy 'type' key with 'rope_type'")
Expand Down

0 comments on commit 902a4bc

Please sign in to comment.