Merge pull request #1254 from wangxingjun778/merge_release_1.23

Merge release_1.23 to master
This commit is contained in:
Xingjun.Wang
2025-03-11 10:52:52 +08:00
committed by GitHub

View File

@@ -345,7 +345,7 @@ def _patch_pretrained_class(all_imported_modules, wrap=False):
else: else:
all_available_modules.append( all_available_modules.append(
get_wrapped_class(var, **ignore_file_pattern_kwargs)) get_wrapped_class(var, **ignore_file_pattern_kwargs))
except: # noqa except Exception:
all_available_modules.append(var) all_available_modules.append(var)
else: else:
if has_from_pretrained and not hasattr(var, if has_from_pretrained and not hasattr(var,
@@ -370,9 +370,10 @@ def _patch_pretrained_class(all_imported_modules, wrap=False):
if has_get_config_dict and not hasattr(var, if has_get_config_dict and not hasattr(var,
'_get_config_dict_origin'): '_get_config_dict_origin'):
var._get_config_dict_origin = var.get_config_dict var._get_config_dict_origin = var.get_config_dict
var.get_config_dict = classmethod( var.get_config_dict = partial(
partial(patch_get_config_dict, patch_pretrained_model_name_or_path,
**ignore_file_pattern_kwargs)) ori_func=var._get_config_dict_origin,
**ignore_file_pattern_kwargs)
all_available_modules.append(var) all_available_modules.append(var)
return all_available_modules return all_available_modules
@@ -618,6 +619,11 @@ def _patch_hub():
# Patch repocard.validate # Patch repocard.validate
from huggingface_hub import repocard from huggingface_hub import repocard
if not hasattr(repocard.RepoCard, '_validate_origin'): if not hasattr(repocard.RepoCard, '_validate_origin'):
def load(*args, **kwargs): # noqa
from huggingface_hub.errors import EntryNotFoundError
raise EntryNotFoundError(message='API not supported.')
repocard.RepoCard._validate_origin = repocard.RepoCard.validate repocard.RepoCard._validate_origin = repocard.RepoCard.validate
repocard.RepoCard.validate = lambda *args, **kwargs: None repocard.RepoCard.validate = lambda *args, **kwargs: None
repocard.RepoCard._load_origin = repocard.RepoCard.load repocard.RepoCard._load_origin = repocard.RepoCard.load