Buckets:
Configuration
Schedulers from SchedulerMixin and models from ModelMixin inherit from ConfigMixin which stores all the parameters that are passed to their respective __init__ methods in a JSON-configuration file.
To use private or gated models, log-in with
hf auth login.
ConfigMixin[[diffusers.ConfigMixin]]
Base class for all configuration classes. All configuration parameters are stored under self.config. Also
provides the from_config() and save_config() methods for loading, downloading, and
saving classes that inherit from ConfigMixin.
Class attributes:
config_name (
str) -- A filename under which the config should stored when calling save_config() (should be overridden by parent class).ignore_for_config (
list[str]) -- A list of attributes that should not be saved in the config (should be overridden by subclass).has_compatibles (
bool) -- Whether the class has compatible classes (should be overridden by subclass)._deprecated_kwargs (
list[str]) -- Keyword arguments that are deprecated. Note that theinitfunction should only have akwargsargument if at least one argument is deprecated (should be overridden by subclass).pretrained_model_name_or_path (
stroros.PathLike, optional) -- Can be either:- A string, the model id (for example
google/ddpm-celebahq-256) of a pretrained model hosted on the Hub. - A path to a directory (for example
./my_model_directory) containing model weights saved with save_config().
- A string, the model id (for example
cache_dir (
str | os.PathLike, optional) -- Path to a directory where a downloaded pretrained model configuration is cached if the standard cache is not used.force_download (
bool, optional, defaults toFalse) -- Whether or not to force the (re-)download of the model weights and configuration files, overriding the cached versions if they exist.proxies (
dict[str, str], optional) -- A dictionary of proxy servers to use by protocol or endpoint, for example,{'http': 'foo.bar:3128', 'http://hostname': 'foo.bar:4012'}. The proxies are used on each request.output_loading_info(
bool, optional, defaults toFalse) -- Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages.local_files_only (
bool, optional, defaults toFalse) -- Whether to only load local model weights and configuration files or not. If set toTrue, the model won't be downloaded from the Hub.token (
stror bool, optional) -- The token to use as HTTP bearer authorization for remote files. IfTrue, the token generated fromdiffusers-cli login(stored in~/.huggingface) is used.revision (
str, optional, defaults to"main") -- The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier allowed by Git.subfolder (
str, optional, defaults to"") -- The subfolder location of a model file within a larger model repository on the Hub or locally.return_unused_kwargs (
bool, optional, defaults to `False) -- Whether unused keyword arguments of the config are returned.return_commit_hash (
bool, optional, defaults toFalse) -- Whether thecommit_hashof the loaded configuration are returned.dict`A dictionary of all the parameters stored in a JSON configuration file.
Load a model or scheduler configuration.
- config (
dict[str, Any]) -- A config dictionary from which the Python class is instantiated. Make sure to only load configuration files of compatible classes. - return_unused_kwargs (
bool, optional, defaults toFalse) -- Whether kwargs that are not consumed by the Python class should be returned or not. - kwargs (remaining dictionary of keyword arguments, optional) --
Can be used to update the configuration object (after it is loaded) and initiate the Python class.
**kwargsare passed directly to the underlying scheduler/model's__init__method and eventually overwrite the same named arguments inconfig.ModelMixin or SchedulerMixinA model or scheduler object instantiated from a config dictionary.
Instantiate a Python class from a config dictionary.
Examples:
>>> from diffusers import DDPMScheduler, DDIMScheduler, PNDMScheduler
>>> # Download scheduler from huggingface.co and cache.
>>> scheduler = DDPMScheduler.from_pretrained("google/ddpm-cifar10-32")
>>> # Instantiate DDIM scheduler class with same config as DDPM
>>> scheduler = DDIMScheduler.from_config(scheduler.config)
>>> # Instantiate PNDM scheduler class with same config as DDPM
>>> scheduler = PNDMScheduler.from_config(scheduler.config)
- save_directory (
stroros.PathLike) -- Directory where the configuration JSON file is saved (will be created if it does not exist). - push_to_hub (
bool, optional, defaults toFalse) -- Whether or not to push your model to the Hugging Face Hub after saving it. You can specify the repository you want to push to withrepo_id(will default to the name ofsave_directoryin your namespace). - kwargs (
dict[str, Any], optional) -- Additional keyword arguments passed along to the push_to_hub() method.
Save a configuration object to the directory specified in save_directory so that it can be reloaded using the
from_config() class method.
- json_file_path (
stroros.PathLike) -- Path to the JSON file to save a configuration instance's parameters.
Save the configuration instance's parameters to a JSON file.
strString containing all the attributes that make up the configuration instance in JSON format.
Serializes the configuration instance to a JSON string.
Xet Storage Details
- Size:
- 6.79 kB
- Xet hash:
- 02c1f758b6d984f5e5336e83aede3fd6fde7b0e9565ae0471f50e1058c0dda17
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.