[Bugfix] GGUF: fix AttributeError: 'PosixPath' object has no attribute 'startswith' (#21579)

Signed-off-by: Kebe <mail@kebe7jun.com>
This commit is contained in:
Kebe 2025-07-25 18:42:23 +08:00 committed by GitHub
parent 8ed01e32f7
commit 7311f74468
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -584,7 +584,7 @@ def get_pooling_config_name(pooling_name: str) -> Union[str, None]:
@cache @cache
def get_sentence_transformer_tokenizer_config(model: str, def get_sentence_transformer_tokenizer_config(model: Union[str, Path],
revision: Optional[str] = 'main' revision: Optional[str] = 'main'
): ):
""" """
@ -592,7 +592,7 @@ def get_sentence_transformer_tokenizer_config(model: str,
given Sentence Transformer BERT model. given Sentence Transformer BERT model.
Parameters: Parameters:
- model (str): The name of the Sentence Transformer - model (str|Path): The name of the Sentence Transformer
BERT model. BERT model.
- revision (str, optional): The revision of the m - revision (str, optional): The revision of the m
odel to use. Defaults to 'main'. odel to use. Defaults to 'main'.
@ -620,7 +620,7 @@ def get_sentence_transformer_tokenizer_config(model: str,
if encoder_dict: if encoder_dict:
break break
if not encoder_dict and not model.startswith("/"): if not encoder_dict and not Path(model).is_absolute():
try: try:
# If model is on HuggingfaceHub, get the repo files # If model is on HuggingfaceHub, get the repo files
repo_files = list_repo_files(model, repo_files = list_repo_files(model,