Skip to content

Commit 247102f

Browse files
authored
[Bugfix] Fix: add patch_rope_scaling after hf override (#20857)
Signed-off-by: Wang Siyuan <wsy0227@sjtu.edu.cn> Signed-off-by: Wang Siyuan <sywang0227@gmail.com>
1 parent bd4c1e6 commit 247102f

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

vllm/config.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -532,16 +532,12 @@ def __post_init__(self) -> None:
532532
self.config_format = ConfigFormat(self.config_format)
533533

534534
hf_config = get_config(self.hf_config_path or self.model,
535-
self.trust_remote_code, self.revision,
536-
self.code_revision, self.config_format)
537-
538-
if hf_overrides_kw:
539-
logger.debug("Overriding HF config with %s", hf_overrides_kw)
540-
hf_config.update(hf_overrides_kw)
541-
if hf_overrides_fn:
542-
logger.debug("Overriding HF config with %s", hf_overrides_fn)
543-
hf_config = hf_overrides_fn(hf_config)
544-
535+
self.trust_remote_code,
536+
self.revision,
537+
self.code_revision,
538+
self.config_format,
539+
hf_overrides_kw=hf_overrides_kw,
540+
hf_overrides_fn=hf_overrides_fn)
545541
self.hf_config = hf_config
546542

547543
self.hf_text_config = get_hf_text_config(self.hf_config)
@@ -5052,4 +5048,4 @@ class SpeechToTextConfig:
50525048

50535049
@property
50545050
def allow_audio_chunking(self) -> bool:
5055-
return self.min_energy_split_window_size is not None
5051+
return self.min_energy_split_window_size is not None

vllm/transformers_utils/config.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ def get_config(
305305
revision: Optional[str] = None,
306306
code_revision: Optional[str] = None,
307307
config_format: ConfigFormat = ConfigFormat.AUTO,
308+
hf_overrides_kw: Optional[dict[str, Any]] = None,
309+
hf_overrides_fn: Optional[Callable[[PretrainedConfig],
310+
PretrainedConfig]] = None,
308311
**kwargs,
309312
) -> PretrainedConfig:
310313
# Separate model folder from file path for GGUF models
@@ -423,6 +426,13 @@ def get_config(
423426
model_type = MODEL_FOR_CAUSAL_LM_MAPPING_NAMES[config.model_type]
424427
config.update({"architectures": [model_type]})
425428

429+
if hf_overrides_kw:
430+
logger.debug("Overriding HF config with %s", hf_overrides_kw)
431+
config.update(hf_overrides_kw)
432+
if hf_overrides_fn:
433+
logger.debug("Overriding HF config with %s", hf_overrides_fn)
434+
config = hf_overrides_fn(config)
435+
426436
patch_rope_scaling(config)
427437

428438
if trust_remote_code:

0 commit comments

Comments
 (0)