text
stringlengths
0
5.54k
Must be one of butterworth, ideal or gaussian to use as the filtering method for the
FreeInit low pass filter. order (int, optional, defaults to 4) —
Order of the filter used in butterworth method. Larger values lead to ideal method behaviour
whereas lower values lead to gaussian method behaviour. spatial_stop_frequency (float, optional, defaults to 0.25) —
Normalized stop frequency for spatial dimensions. Must be between 0 to 1. Referred to as d_s in
the original implementation. temporal_stop_frequency (float, optional, defaults to 0.25) —
Normalized stop frequency for temporal dimensions. Must be between 0 to 1. Referred to as d_t in
the original implementation. generator (torch.Generator, optional, defaults to 0.25) —
A torch.Generator to make
FreeInit generation deterministic. Enables the FreeInit mechanism as in https://arxiv.org/abs/2312.07537. This implementation has been adapted from the official repository. enable_freeu < source > ( s1: float s2: float b1: float b2: float ) Parameters s1 (float) —
Scaling factor for stage 1 to attenuate the contributions of the skip features. This is done to
mitigate “oversmoothing effect” in the enhanced denoising process. s2 (float) —
Scaling factor for stage 2 to attenuate the contributions of the skip features. This is done to
mitigate “oversmoothing effect” in the enhanced denoising process. b1 (float) — Scaling factor for stage 1 to amplify the contributions of backbone features. b2 (float) — Scaling factor for stage 2 to amplify the contributions of backbone features. Enables the FreeU mechanism as in https://arxiv.org/abs/2309.114...
that are known to work well for different pipelines such as Stable Diffusion v1, v2, and Stable Diffusion XL. enable_vae_slicing < source > ( ) Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to
compute decoding in several steps. This is useful to save some memory and allow larger batch sizes. enable_vae_tiling < source > ( ) Enable tiled VAE decoding. When this option is enabled, the VAE will split the input tensor into tiles to
compute decoding and encoding in several steps. This is useful for saving a large amount of memory and to allow
processing larger images. encode_prompt < source > ( prompt device num_images_per_prompt do_classifier_free_guidance negative_prompt = None prompt_embeds: Optional = None negative_prompt_embeds: Optional = None lora_scale: Optional = None clip_skip: Optional = None ) Parameters prompt (str or List[str], optional...
prompt to be encoded
device — (torch.device):
torch device num_images_per_prompt (int) —
number of images that should be generated per prompt do_classifier_free_guidance (bool) —
whether to use classifier free guidance or not negative_prompt (str or List[str], optional) —
The prompt or prompts not to guide the image generation. If not defined, one has to pass
negative_prompt_embeds instead. Ignored when not using guidance (i.e., ignored if guidance_scale is
less than 1). prompt_embeds (torch.FloatTensor, optional) —
Pre-generated text embeddings. Can be used to easily tweak text inputs, e.g. prompt weighting. If not
provided, text embeddings will be generated from prompt input argument. negative_prompt_embeds (torch.FloatTensor, optional) —
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, e.g. prompt
weighting. If not provided, negative_prompt_embeds will be generated from negative_prompt input
argument. lora_scale (float, optional) —
A LoRA scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded. clip_skip (int, optional) —
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that
the output of the pre-final layer will be used for computing the prompt embeddings. Encodes the prompt into text encoder hidden states. enable_freeu disable_freeu enable_free_init disable_free_init enable_vae_slicing disable_vae_slicing enable_vae_tiling disable_vae_tiling PIAPipelineOutput class diffusers.pipelin...
UNet1DModel The UNet model was originally introduced by Ronneberger et al. for biomedical image segmentation, but it is also commonly used in 🤗 Diffusers because it outputs images that are the same size as the input. It is one of the most important components of a diffusion system because it facilitates the actual dif...
Number of additional channels to be added to the input of the first down block. Useful for cases where the
input data has more channels than what the model was initially designed for. time_embedding_type (str, optional, defaults to "fourier") — Type of time embedding to use. freq_shift (float, optional, defaults to 0.0) — Frequency shift for Fourier time embedding. flip_sin_to_cos (bool, optional, defaults to False) —
Whether to flip sin to cos for Fourier time embedding. down_block_types (Tuple[str], optional, defaults to ("DownBlock1DNoSkip", "DownBlock1D", "AttnDownBlock1D")) —
Tuple of downsample block types. up_block_types (Tuple[str], optional, defaults to ("AttnUpBlock1D", "UpBlock1D", "UpBlock1DNoSkip")) —
Tuple of upsample block types. block_out_channels (Tuple[int], optional, defaults to (32, 32, 64)) —
Tuple of block output channels. mid_block_type (str, optional, defaults to "UNetMidBlock1D") — Block type for middle of UNet. out_block_type (str, optional, defaults to None) — Optional output processing block of UNet. act_fn (str, optional, defaults to None) — Optional activation function in UNet blocks. norm_...
Experimental feature for using a UNet without upsampling. A 1D UNet model that takes a noisy sample and a timestep and returns a sample shaped output. This model inherits from ModelMixin. Check the superclass documentation for it’s generic methods implemented
for all models (such as downloading or saving). forward < source > ( sample: FloatTensor timestep: Union return_dict: bool = True ) → ~models.unet_1d.UNet1DOutput or tuple Parameters sample (torch.FloatTensor) —
The noisy input tensor with the following shape (batch_size, num_channels, sample_size). timestep (torch.FloatTensor or float or int) — The number of timesteps to denoise an input. return_dict (bool, optional, defaults to True) —
Whether or not to return a ~models.unet_1d.UNet1DOutput instead of a plain tuple. Returns
~models.unet_1d.UNet1DOutput or tuple
If return_dict is True, an ~models.unet_1d.UNet1DOutput is returned, otherwise a tuple is
returned where the first element is the sample tensor.
The UNet1DModel forward method. UNet1DOutput class diffusers.models.unets.unet_1d.UNet1DOutput < source > ( sample: FloatTensor ) Parameters sample (torch.FloatTensor of shape (batch_size, num_channels, sample_size)) —
The hidden states output from the last layer of the model. The output of UNet1DModel.
Logging 🤗 Diffusers has a centralized logging system to easily manage the verbosity of the library. The default verbosity is set to WARNING. To change the verbosity level, use one of the direct setters. For instance, to change the verbosity to the INFO level. Copied import diffusers
diffusers.logging.set_verbosity_info() You can also use the environment variable DIFFUSERS_VERBOSITY to override the default verbosity. You can set it
to one of the following: debug, info, warning, error, critical. For example: Copied DIFFUSERS_VERBOSITY=error ./myprogram.py Additionally, some warnings can be disabled by setting the environment variable
DIFFUSERS_NO_ADVISORY_WARNINGS to a true value, like 1. This disables any warning logged by
logger.warning_advice. For example: Copied DIFFUSERS_NO_ADVISORY_WARNINGS=1 ./myprogram.py Here is an example of how to use the same logger as the library in your own module or script: Copied from diffusers.utils import logging
logging.set_verbosity_info()
logger = logging.get_logger("diffusers")
logger.info("INFO")
logger.warning("WARN") All methods of the logging module are documented below. The main methods are
logging.get_verbosity() to get the current level of verbosity in the logger and
logging.set_verbosity() to set the verbosity to the level of your choice. In order from the least verbose to the most verbose: Method Integer value Description diffusers.logging.CRITICAL or diffusers.logging.FATAL 50 only report the most critical errors diffusers.logging.ERROR 40 only report errors diffusers.logging.WA...
int
Logging level integers which can be one of:
50: diffusers.logging.CRITICAL or diffusers.logging.FATAL
40: diffusers.logging.ERROR
30: diffusers.logging.WARNING or diffusers.logging.WARN
20: diffusers.logging.INFO
10: diffusers.logging.DEBUG
Return the current level for the 🤗 Diffusers’ root logger as an int. diffusers.utils.logging.set_verbosity < source > ( verbosity: int ) Parameters verbosity (int) —
Logging level which can be one of:
diffusers.logging.CRITICAL or diffusers.logging.FATAL
diffusers.logging.ERROR
diffusers.logging.WARNING or diffusers.logging.WARN
diffusers.logging.INFO
diffusers.logging.DEBUG
Set the verbosity level for the 🤗 Diffusers’ root logger. diffusers.utils.get_logger < source > ( name: Optional = None ) Return a logger with the specified name. This function is not supposed to be directly accessed unless you are writing a custom diffusers module. diffusers.utils.logging.enable_default_ha...
All handlers currently bound to the root logger are affected by this method. diffusers.utils.logging.reset_format < source > ( ) Resets the formatting for 🤗 Diffusers’ loggers. All handlers currently bound to the root logger are affected by this method. diffusers.utils.logging.enable_progress_bar < source > ( )...
ConsistencyDecoderScheduler This scheduler is a part of the ConsistencyDecoderPipeline and was introduced in DALL-E 3. The original codebase can be found at openai/consistency_models. ConsistencyDecoderScheduler class diffusers.schedulers.ConsistencyDecoderScheduler < source > ( num_train_timesteps: int = 1024 sigma...
The input sample. timestep (int, optional) —
The current timestep in the diffusion chain. Returns
torch.FloatTensor
A scaled input sample.
Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep. step < source > ( model_output: FloatTensor timestep: Union sample: FloatTensor generator: Optional = None return_dict: bool = True ) → ~schedulers.scheduling_consistency_models.ConsistencyDecoderSchedulerOutput or tuple Parameters model_output (torch.FloatTensor) —
The direct output from the learned diffusion model. timestep (float) —
The current timestep in the diffusion chain. sample (torch.FloatTensor) —
A current instance of a sample created by the diffusion process. generator (torch.Generator, optional) —
A random number generator. return_dict (bool, optional, defaults to True) —
Whether or not to return a
~schedulers.scheduling_consistency_models.ConsistencyDecoderSchedulerOutput or tuple. Returns
~schedulers.scheduling_consistency_models.ConsistencyDecoderSchedulerOutput or tuple