text stringlengths 0 5.54k |
|---|
If return_dict is True, |
~schedulers.scheduling_consistency_models.ConsistencyDecoderSchedulerOutput is returned, otherwise |
a tuple is returned where the first element is the sample tensor. |
Predict the sample from the previous timestep by reversing the SDE. This function propagates the diffusion |
process from the learned model outputs (most often the predicted noise). |
AutoencoderKL The variational autoencoder (VAE) model with KL loss was introduced in Auto-Encoding Variational Bayes by Diederik P. Kingma and Max Welling. The model is used in π€ Diffusers to encode images into latents and to decode latent representations into images. The abstract from the paper is: How can we perform... |
from the original format using FromOriginalVAEMixin.from_single_file as follows: Copied from diffusers import AutoencoderKL |
url = "https://huggingface.co/stabilityai/sd-vae-ft-mse-original/blob/main/vae-ft-mse-840000-ema-pruned.safetensors" # can also be a local file |
model = AutoencoderKL.from_single_file(url) AutoencoderKL class diffusers.AutoencoderKL < source > ( in_channels: int = 3 out_channels: int = 3 down_block_types: Tuple = ('DownEncoderBlock2D',) up_block_types: Tuple = ('UpDecoderBlock2D',) block_out_channels: Tuple = (64,) layers_per_block: int = 1 act_fn: str = 'si... |
Tuple of downsample block types. up_block_types (Tuple[str], optional, defaults to ("UpDecoderBlock2D",)) β |
Tuple of upsample block types. block_out_channels (Tuple[int], optional, defaults to (64,)) β |
Tuple of block output channels. act_fn (str, optional, defaults to "silu") β The activation function to use. latent_channels (int, optional, defaults to 4) β Number of channels in the latent space. sample_size (int, optional, defaults to 32) β Sample input size. scaling_factor (float, optional, defaults to 0.18... |
The component-wise standard deviation of the trained latent space computed using the first batch of the |
training set. This is used to scale the latent space to have unit variance when training the diffusion |
model. The latents are scaled with the formula z = z * scaling_factor before being passed to the |
diffusion model. When decoding, the latents are scaled back to the original scale with the formula: z = 1 / scaling_factor * z. For more details, refer to sections 4.3.2 and D.1 of the High-Resolution Image |
Synthesis with Latent Diffusion Models paper. force_upcast (bool, optional, default to True) β |
If enabled it will force the VAE to run in float32 for high image resolution pipelines, such as SD-XL. VAE |
can be fine-tuned / trained to a lower range without loosing too much precision in which case |
force_upcast can be set to False - see: https://huggingface.co/madebyollin/sdxl-vae-fp16-fix A VAE model with KL loss for encoding images into latents and decoding latent representations into images. This model inherits from ModelMixin. Check the superclass documentation for itβs generic methods implemented |
for all models (such as downloading or saving). wrapper < source > ( *args **kwargs ) wrapper < source > ( *args **kwargs ) disable_slicing < source > ( ) Disable sliced VAE decoding. If enable_slicing was previously enabled, this method will go back to computing |
decoding in one step. disable_tiling < source > ( ) Disable tiled VAE decoding. If enable_tiling was previously enabled, this method will go back to computing |
decoding in one step. enable_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_tiling < source > ( use_tiling: bool = True ) 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. forward < source > ( sample: FloatTensor sample_posterior: bool = False return_dict: bool = True generator: Optional = None ) Parameters sample (torch.FloatTensor) β Input sample. sample_posterior (bool, optional, defaults to False) β |
Whether to sample from the posterior. return_dict (bool, optional, defaults to True) β |
Whether or not to return a DecoderOutput instead of a plain tuple. fuse_qkv_projections < source > ( ) Enables fused QKV projections. For self-attention modules, all projection matrices (i.e., query, |
key, value) are fused. For cross-attention modules, key and value projection matrices are fused. This API is π§ͺ experimental. set_attn_processor < source > ( processor: Union ) Parameters processor (dict of AttentionProcessor or only AttentionProcessor) β |
The instantiated processor class or a dictionary of processor classes that will be set as the processor |
for all Attention layers. |
If processor is a dict, the key needs to define the path to the corresponding cross attention |
processor. This is strongly recommended when setting trainable attention processors. Sets the attention processor to use to compute attention. set_default_attn_processor < source > ( ) Disables custom attention processors and sets the default attention implementation. tiled_decode < source > ( z: FloatTensor ... |
Whether or not to return a ~models.vae.DecoderOutput instead of a plain tuple. Returns |
~models.vae.DecoderOutput or tuple |
If return_dict is True, a ~models.vae.DecoderOutput is returned, otherwise a plain tuple is |
returned. |
Decode a batch of images using a tiled decoder. tiled_encode < source > ( x: FloatTensor return_dict: bool = True ) β ~models.autoencoder_kl.AutoencoderKLOutput or tuple Parameters x (torch.FloatTensor) β Input batch of images. return_dict (bool, optional, defaults to True) β |
Whether or not to return a ~models.autoencoder_kl.AutoencoderKLOutput instead of a plain tuple. Returns |
~models.autoencoder_kl.AutoencoderKLOutput or tuple |
If return_dict is True, a ~models.autoencoder_kl.AutoencoderKLOutput is returned, otherwise a plain |
tuple is returned. |
Encode a batch of images using a tiled encoder. When this option is enabled, the VAE will split the input tensor into tiles to compute encoding in several |
steps. This is useful to keep memory use constant regardless of image size. The end result of tiled encoding is |
different from non-tiled encoding because each tile uses a different encoder. To avoid tiling artifacts, the |
tiles overlap and are blended together to form a smooth output. You may still see tile-sized changes in the |
output, but they should be much less noticeable. unfuse_qkv_projections < source > ( ) Disables the fused QKV projection if enabled. This API is π§ͺ experimental. AutoencoderKLOutput class diffusers.models.modeling_outputs.AutoencoderKLOutput < source > ( latent_dist: DiagonalGaussianDistribution ) Parameters... |
Encoded outputs of Encoder represented as the mean and logvar of DiagonalGaussianDistribution. |
DiagonalGaussianDistribution allows for sampling latents from the distribution. Output of AutoencoderKL encoding method. DecoderOutput class diffusers.models.autoencoders.vae.DecoderOutput < source > ( sample: FloatTensor ) Parameters sample (torch.FloatTensor of shape (batch_size, num_channels, height, widt... |
The decoded output sample from the last layer of the model. Output of decoding method. FlaxAutoencoderKL class diffusers.FlaxAutoencoderKL < source > ( in_channels: int = 3 out_channels: int = 3 down_block_types: Tuple = ('DownEncoderBlock2D',) up_block_types: Tuple = ('UpDecoderBlock2D',) block_out_channels: Tup... |
Number of channels in the input image. out_channels (int, optional, defaults to 3) β |
Number of channels in the output. down_block_types (Tuple[str], optional, defaults to (DownEncoderBlock2D)) β |
Tuple of downsample block types. up_block_types (Tuple[str], optional, defaults to (UpDecoderBlock2D)) β |
Tuple of upsample block types. block_out_channels (Tuple[str], optional, defaults to (64,)) β |
Tuple of block output channels. layers_per_block (int, optional, defaults to 2) β |
Number of ResNet layer for each block. act_fn (str, optional, defaults to silu) β |
The activation function to use. latent_channels (int, optional, defaults to 4) β |
Number of channels in the latent space. norm_num_groups (int, optional, defaults to 32) β |
The number of groups for normalization. sample_size (int, optional, defaults to 32) β |
Sample input size. scaling_factor (float, optional, defaults to 0.18215) β |
The component-wise standard deviation of the trained latent space computed using the first batch of the |
training set. This is used to scale the latent space to have unit variance when training the diffusion |
model. The latents are scaled with the formula z = z * scaling_factor before being passed to the |
diffusion model. When decoding, the latents are scaled back to the original scale with the formula: z = 1 / scaling_factor * z. For more details, refer to sections 4.3.2 and D.1 of the High-Resolution Image |
Synthesis with Latent Diffusion Models paper. dtype (jnp.dtype, optional, defaults to jnp.float32) β |
The dtype of the parameters. Flax implementation of a VAE model with KL loss for decoding latent representations. This model inherits from FlaxModelMixin. Check the superclass documentation for itβs generic methods |
implemented for all models (such as downloading or saving). This model is a Flax Linen flax.linen.Module |
subclass. Use it as a regular Flax Linen module and refer to the Flax documentation for all matter related to its |
general usage and behavior. Inherent JAX features such as the following are supported: Just-In-Time (JIT) compilation Automatic Differentiation Vectorization Parallelization FlaxAutoencoderKLOutput class diffusers.models.vae_flax.FlaxAutoencoderKLOutput < source > ( latent_dist: FlaxDiagonalGaussianDistribution ) ... |
Encoded outputs of Encoder represented as the mean and logvar of FlaxDiagonalGaussianDistribution. |
FlaxDiagonalGaussianDistribution allows for sampling latents from the distribution. Output of AutoencoderKL encoding method. replace < source > ( **updates ) βReturns a new object replacing the specified fields with new values. FlaxDecoderOutput class diffusers.models.vae_flax.FlaxDecoderOutput < source > (... |
The decoded output sample from the last layer of the model. dtype (jnp.dtype, optional, defaults to jnp.float32) β |
The dtype of the parameters. Output of decoding method. replace < source > ( **updates ) βReturns a new object replacing the specified fields with new values. |
InstructPix2Pix InstructPix2Pix: Learning to Follow Image Editing Instructions is by Tim Brooks, Aleksander Holynski and Alexei A. Efros. The abstract from the paper is: We propose a method for editing images from human instructions: given an input image and a written instruction that tells the model what to do, our mo... |
Variational Auto-Encoder (VAE) model to encode and decode images to and from latent representations. text_encoder (CLIPTextModel) β |
Frozen text-encoder (clip-vit-large-patch14). tokenizer (CLIPTokenizer) β |
A CLIPTokenizer to tokenize text. unet (UNet2DConditionModel) β |
A UNet2DConditionModel to denoise the encoded image latents. scheduler (SchedulerMixin) β |
A scheduler to be used in combination with unet to denoise the encoded image latents. Can be one of |
DDIMScheduler, LMSDiscreteScheduler, or PNDMScheduler. safety_checker (StableDiffusionSafetyChecker) β |
Classification module that estimates whether generated images could be considered offensive or harmful. |
Please refer to the model card for more details |
about a modelβs potential harms. feature_extractor (CLIPImageProcessor) β |
A CLIPImageProcessor to extract features from generated images; used as inputs to the safety_checker. Pipeline for pixel-level image editing by following text instructions (based on Stable Diffusion). This model inherits from DiffusionPipeline. Check the superclass documentation for the generic methods |
implemented for all pipelines (downloading, saving, running on a particular device, etc.). The pipeline also inherits the following loading methods: load_textual_inversion() for loading textual inversion embeddings load_lora_weights() for loading LoRA weights save_lora_weights() for saving LoRA weights load_ip_adapter(... |
The prompt or prompts to guide image generation. If not defined, you need to pass prompt_embeds. image (torch.FloatTensor np.ndarray, PIL.Image.Image, List[torch.FloatTensor], List[PIL.Image.Image], or List[np.ndarray]) β |
Image or tensor representing an image batch to be repainted according to prompt. Can also accept |
image latents as image, but if passing latents directly it is not encoded again. num_inference_steps (int, optional, defaults to 100) β |
The number of denoising steps. More denoising steps usually lead to a higher quality image at the |
expense of slower inference. guidance_scale (float, optional, defaults to 7.5) β |
A higher guidance scale value encourages the model to generate images closely linked to the text |
prompt at the expense of lower image quality. Guidance scale is enabled when guidance_scale > 1. image_guidance_scale (float, optional, defaults to 1.5) β |
Push the generated image towards the inital image. Image guidance scale is enabled by setting |
image_guidance_scale > 1. Higher image guidance scale encourages generated images that are closely |
linked to the source image, usually at the expense of lower image quality. This pipeline requires a |
value of at least 1. negative_prompt (str or List[str], optional) β |
The prompt or prompts to guide what to not include in image generation. If not defined, you need to |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.