Diffusers BOINC AI docs
  • 🌍GET STARTED
    • Diffusers
    • Quicktour
    • Effective and efficient diffusion
    • Installation
  • 🌍TUTORIALS
    • Overview
    • Understanding models and schedulers
    • AutoPipeline
    • Train a diffusion model
  • 🌍USING DIFFUSERS
    • 🌍LOADING & HUB
      • Overview
      • Load pipelines, models, and schedulers
      • Load and compare different schedulers
      • Load community pipelines
      • Load safetensors
      • Load different Stable Diffusion formats
      • Push files to the Hub
    • 🌍TASKS
      • Unconditional image generation
      • Text-to-image
      • Image-to-image
      • Inpainting
      • Depth-to-image
    • 🌍TECHNIQUES
      • Textual inversion
      • Distributed inference with multiple GPUs
      • Improve image quality with deterministic generation
      • Control image brightness
      • Prompt weighting
    • 🌍PIPELINES FOR INFERENCE
      • Overview
      • Stable Diffusion XL
      • ControlNet
      • Shap-E
      • DiffEdit
      • Distilled Stable Diffusion inference
      • Create reproducible pipelines
      • Community pipelines
      • How to contribute a community pipeline
    • 🌍TRAINING
      • Overview
      • Create a dataset for training
      • Adapt a model to a new task
      • Unconditional image generation
      • Textual Inversion
      • DreamBooth
      • Text-to-image
      • Low-Rank Adaptation of Large Language Models (LoRA)
      • ControlNet
      • InstructPix2Pix Training
      • Custom Diffusion
      • T2I-Adapters
    • 🌍TAKING DIFFUSERS BEYOND IMAGES
      • Other Modalities
  • 🌍OPTIMIZATION/SPECIAL HARDWARE
    • Overview
    • Memory and Speed
    • Torch2.0 support
    • Stable Diffusion in JAX/Flax
    • xFormers
    • ONNX
    • OpenVINO
    • Core ML
    • MPS
    • Habana Gaudi
    • Token Merging
  • 🌍CONCEPTUAL GUIDES
    • Philosophy
    • Controlled generation
    • How to contribute?
    • Diffusers' Ethical Guidelines
    • Evaluating Diffusion Models
  • 🌍API
    • 🌍MAIN CLASSES
      • Attention Processor
      • Diffusion Pipeline
      • Logging
      • Configuration
      • Outputs
      • Loaders
      • Utilities
      • VAE Image Processor
    • 🌍MODELS
      • Overview
      • UNet1DModel
      • UNet2DModel
      • UNet2DConditionModel
      • UNet3DConditionModel
      • VQModel
      • AutoencoderKL
      • AsymmetricAutoencoderKL
      • Tiny AutoEncoder
      • Transformer2D
      • Transformer Temporal
      • Prior Transformer
      • ControlNet
    • 🌍PIPELINES
      • Overview
      • AltDiffusion
      • Attend-and-Excite
      • Audio Diffusion
      • AudioLDM
      • AudioLDM 2
      • AutoPipeline
      • Consistency Models
      • ControlNet
      • ControlNet with Stable Diffusion XL
      • Cycle Diffusion
      • Dance Diffusion
      • DDIM
      • DDPM
      • DeepFloyd IF
      • DiffEdit
      • DiT
      • IF
      • PaInstructPix2Pix
      • Kandinsky
      • Kandinsky 2.2
      • Latent Diffusionge
      • MultiDiffusion
      • MusicLDM
      • PaintByExample
      • Parallel Sampling of Diffusion Models
      • Pix2Pix Zero
      • PNDM
      • RePaint
      • Score SDE VE
      • Self-Attention Guidance
      • Semantic Guidance
      • Shap-E
      • Spectrogram Diffusion
      • 🌍STABLE DIFFUSION
        • Overview
        • Text-to-image
        • Image-to-image
        • Inpainting
        • Depth-to-image
        • Image variation
        • Safe Stable Diffusion
        • Stable Diffusion 2
        • Stable Diffusion XL
        • Latent upscaler
        • Super-resolution
        • LDM3D Text-to-(RGB, Depth)
        • Stable Diffusion T2I-adapter
        • GLIGEN (Grounded Language-to-Image Generation)
      • Stable unCLIP
      • Stochastic Karras VE
      • Text-to-image model editing
      • Text-to-video
      • Text2Video-Zero
      • UnCLIP
      • Unconditional Latent Diffusion
      • UniDiffuser
      • Value-guided sampling
      • Versatile Diffusion
      • VQ Diffusion
      • Wuerstchen
    • 🌍SCHEDULERS
      • Overview
      • CMStochasticIterativeScheduler
      • DDIMInverseScheduler
      • DDIMScheduler
      • DDPMScheduler
      • DEISMultistepScheduler
      • DPMSolverMultistepInverse
      • DPMSolverMultistepScheduler
      • DPMSolverSDEScheduler
      • DPMSolverSinglestepScheduler
      • EulerAncestralDiscreteScheduler
      • EulerDiscreteScheduler
      • HeunDiscreteScheduler
      • IPNDMScheduler
      • KarrasVeScheduler
      • KDPM2AncestralDiscreteScheduler
      • KDPM2DiscreteScheduler
      • LMSDiscreteScheduler
      • PNDMScheduler
      • RePaintScheduler
      • ScoreSdeVeScheduler
      • ScoreSdeVpScheduler
      • UniPCMultistepScheduler
      • VQDiffusionScheduler
Powered by GitBook
On this page
  • Configuration
  • ConfigMixin
  1. API
  2. MAIN CLASSES

Configuration

PreviousLoggingNextOutputs

Last updated 1 year ago

Configuration

Schedulers from and models from inherit from which stores all the parameters that are passed to their respective __init__ methods in a JSON-configuration file.

To use private or models, log-in with boincai-cli login.

ConfigMixin

class diffusers.ConfigMixin

( )

Base class for all configuration classes. All configuration parameters are stored under self.config. Also provides the and methods for loading, downloading, and saving classes that inherit from .

Class attributes:

  • config_name (str) β€” A filename under which the config should stored when calling (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 the init function should only have a kwargs argument if at least one argument is deprecated (should be overridden by subclass).

load_config

( pretrained_model_name_or_path: typing.Union[str, os.PathLike]return_unused_kwargs = Falsereturn_commit_hash = False**kwargs ) β†’ dict

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 hosted on the Hub.

  • cache_dir (Union[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 to False) β€” Whether or not to force the (re-)download of the model weights and configuration files, overriding the cached versions if they exist.

  • resume_download (bool, optional, defaults to False) β€” Whether or not to resume downloading the model weights and configuration files. If set to False, any incompletely downloaded files are deleted.

  • 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 to False) β€” Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages.

  • local_files_only (bool, optional, defaults to False) β€” Whether to only load local model weights and configuration files or not. If set to True, the model won’t be downloaded from the Hub.

  • use_auth_token (str or bool, optional) β€” The token to use as HTTP bearer authorization for remote files. If True, the token generated from diffusers-cli login (stored in ~/.boincai) 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 to False) -- Whether the commit_hash` of the loaded configuration are returned.

Returns

dict

A dictionary of all the parameters stored in a JSON configuration file.

Load a model or scheduler configuration.

from_config

Parameters

  • 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 to False) β€” 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. **kwargs are passed directly to the underlying scheduler/model’s __init__ method and eventually overwrite the same named arguments in config.

Returns

A model or scheduler object instantiated from a config dictionary.

Instantiate a Python class from a config dictionary.

Examples:

Copied

>>> from diffusers import DDPMScheduler, DDIMScheduler, PNDMScheduler

>>> # Download scheduler from boincai.com 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_config

( save_directory: typing.Union[str, os.PathLike]push_to_hub: bool = False**kwargs )

Parameters

  • save_directory (str or os.PathLike) β€” Directory where the configuration JSON file is saved (will be created if it does not exist).

  • push_to_hub (bool, optional, defaults to False) β€” Whether or not to push your model to the BOINC AI Hub after saving it. You can specify the repository you want to push to with repo_id (will default to the name of save_directory in your namespace).

to_json_file

( json_file_path: typing.Union[str, os.PathLike] )

Parameters

  • json_file_path (str or os.PathLike) β€” Path to the JSON file to save a configuration instance’s parameters.

Save the configuration instance’s parameters to a JSON file.

to_json_string

( ) β†’ str

Returns

str

String containing all the attributes that make up the configuration instance in JSON format.

Serializes the configuration instance to a JSON string.

A path to a directory (for example ./my_model_directory) containing model weights saved with .

( config: typing.Union[diffusers.configuration_utils.FrozenDict, typing.Dict[str, typing.Any]] = Nonereturn_unused_kwargs = False**kwargs ) β†’ or

or

kwargs (Dict[str, Any], optional) β€” Additional keyword arguments passed along to the method.

Save a configuration object to the directory specified in save_directory so that it can be reloaded using the class method.

🌍
🌍
SchedulerMixin
ModelMixin
ConfigMixin
gated
<source>
from_config()
save_config()
ConfigMixin
save_config()
<source>
save_config()
<source>
ModelMixin
SchedulerMixin
ModelMixin
SchedulerMixin
<source>
push_to_hub()
from_config()
<source>
<source>