MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / load_config

Method load_config

diffusers/src/diffusers/configuration_utils.py:288–449  ·  view source on GitHub ↗

r""" Load a model or scheduler configuration. Parameters: pretrained_model_name_or_path (`str` or `os.PathLike`, *optional*): Can be either: - A string, the *model id* (for example `google/ddpm-celebahq-256`) of a pretrained model hos

(
        cls,
        pretrained_model_name_or_path: Union[str, os.PathLike],
        return_unused_kwargs=False,
        return_commit_hash=False,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

286 @classmethod
287 @validate_hf_hub_args
288 def load_config(
289 cls,
290 pretrained_model_name_or_path: Union[str, os.PathLike],
291 return_unused_kwargs=False,
292 return_commit_hash=False,
293 **kwargs,
294 ) -> Tuple[Dict[str, Any], Dict[str, Any]]:
295 r"""
296 Load a model or scheduler configuration.
297
298 Parameters:
299 pretrained_model_name_or_path (`str` or `os.PathLike`, *optional*):
300 Can be either:
301
302 - A string, the *model id* (for example `google/ddpm-celebahq-256`) of a pretrained model hosted on
303 the Hub.
304 - A path to a *directory* (for example `./my_model_directory`) containing model weights saved with
305 [`~ConfigMixin.save_config`].
306
307 cache_dir (`Union[str, os.PathLike]`, *optional*):
308 Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
309 is not used.
310 force_download (`bool`, *optional*, defaults to `False`):
311 Whether or not to force the (re-)download of the model weights and configuration files, overriding the
312 cached versions if they exist.
313 proxies (`Dict[str, str]`, *optional*):
314 A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
315 'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
316 output_loading_info(`bool`, *optional*, defaults to `False`):
317 Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages.
318 local_files_only (`bool`, *optional*, defaults to `False`):
319 Whether to only load local model weights and configuration files or not. If set to `True`, the model
320 won't be downloaded from the Hub.
321 token (`str` or *bool*, *optional*):
322 The token to use as HTTP bearer authorization for remote files. If `True`, the token generated from
323 `diffusers-cli login` (stored in `~/.huggingface`) is used.
324 revision (`str`, *optional*, defaults to `"main"`):
325 The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier
326 allowed by Git.
327 subfolder (`str`, *optional*, defaults to `""`):
328 The subfolder location of a model file within a larger model repository on the Hub or locally.
329 return_unused_kwargs (`bool`, *optional*, defaults to `False):
330 Whether unused keyword arguments of the config are returned.
331 return_commit_hash (`bool`, *optional*, defaults to `False):
332 Whether the `commit_hash` of the loaded configuration are returned.
333
334 Returns:
335 `dict`:
336 A dictionary of all the parameters stored in a JSON configuration file.
337
338 """
339 cache_dir = kwargs.pop("cache_dir", None)
340 local_dir = kwargs.pop("local_dir", None)
341 local_dir_use_symlinks = kwargs.pop("local_dir_use_symlinks", "auto")
342 force_download = kwargs.pop("force_download", False)
343 proxies = kwargs.pop("proxies", None)
344 token = kwargs.pop("token", None)
345 local_files_only = kwargs.pop("local_files_only", False)

Callers 15

from_pretrainedMethod · 0.80
from_configMethod · 0.80
get_config_dictMethod · 0.80
from_pretrainedMethod · 0.80
from_pretrainedMethod · 0.80
from_pretrainedMethod · 0.80
_load_empty_modelFunction · 0.80
from_pretrainedMethod · 0.80
from_pretrainedMethod · 0.80
downloadMethod · 0.80
from_pretrainedMethod · 0.80
from_pretrainedMethod · 0.80

Calls 4

http_user_agentFunction · 0.85
extract_commit_hashFunction · 0.85
_dict_from_json_fileMethod · 0.80
popMethod · 0.45