[Bugfix] Fix failing GGUF models test (#22174)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
This commit is contained in:
Isotr0py 2025-08-04 16:27:02 +08:00 committed by GitHub
parent c1b4eb048a
commit fed5849d3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -290,20 +290,29 @@ def _maybe_remap_hf_config_attrs(config: PretrainedConfig) -> PretrainedConfig:
def maybe_override_with_speculators_target_model(
model: str,
tokenizer: str,
trust_remote_code: bool,
revision: Optional[str] = None) -> tuple[str, str]:
model: str,
tokenizer: str,
trust_remote_code: bool,
revision: Optional[str] = None,
**kwargs,
) -> tuple[str, str]:
"""
If running a speculators config, override running model with target model
"""
is_gguf = check_gguf_file(model)
if is_gguf:
kwargs["gguf_file"] = Path(model).name
gguf_model_repo = Path(model).parent
else:
gguf_model_repo = None
config_dict, _ = PretrainedConfig.get_config_dict(
model,
model if gguf_model_repo is None else gguf_model_repo,
revision=revision,
trust_remote_code=trust_remote_code,
token=_get_hf_token(),
**kwargs,
)
spec_config = config_dict.get("speculators_config")
spec_config = config_dict.get("speculators_config", None)
# Return the target model
if spec_config is not None:
model = tokenizer = spec_config["verifier"]["name_or_path"]