File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -290,20 +290,29 @@ def _maybe_remap_hf_config_attrs(config: PretrainedConfig) -> PretrainedConfig:
290290
291291
292292def maybe_override_with_speculators_target_model (
293- model : str ,
294- tokenizer : str ,
295- trust_remote_code : bool ,
296- revision : Optional [str ] = None ) -> tuple [str , str ]:
293+ model : str ,
294+ tokenizer : str ,
295+ trust_remote_code : bool ,
296+ revision : Optional [str ] = None ,
297+ ** kwargs ,
298+ ) -> tuple [str , str ]:
297299 """
298300 If running a speculators config, override running model with target model
299301 """
302+ is_gguf = check_gguf_file (model )
303+ if is_gguf :
304+ kwargs ["gguf_file" ] = Path (model ).name
305+ gguf_model_repo = Path (model ).parent
306+ else :
307+ gguf_model_repo = None
300308 config_dict , _ = PretrainedConfig .get_config_dict (
301- model ,
309+ model if gguf_model_repo is None else gguf_model_repo ,
302310 revision = revision ,
303311 trust_remote_code = trust_remote_code ,
304312 token = _get_hf_token (),
313+ ** kwargs ,
305314 )
306- spec_config = config_dict .get ("speculators_config" )
315+ spec_config = config_dict .get ("speculators_config" , None )
307316 # Return the target model
308317 if spec_config is not None :
309318 model = tokenizer = spec_config ["verifier" ]["name_or_path" ]
You can’t perform that action at this time.
0 commit comments