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
  • AutoPipeline
  • AutoPipelineForText2Image
  • AutoPipelineForImage2Image
  • AutoPipelineForInpainting
  1. API
  2. PIPELINES

AutoPipeline

PreviousAudioLDM 2NextConsistency Models

Last updated 1 year ago

AutoPipeline

AutoPipeline is designed to:

  1. make it easy for you to load a checkpoint for a task without knowing the specific pipeline class to use

  2. use multiple pipelines in your workflow

Based on the task, the AutoPipeline class automatically retrieves the relevant pipeline given the name or path to the pretrained weights with the from_pretrained() method.

To seamlessly switch between tasks with the same checkpoint without reallocating additional memory, use the from_pipe() method to transfer the components from the original pipeline to the new one.

Copied

from diffusers import AutoPipelineForText2Image
import torch

pipeline = AutoPipelineForText2Image.from_pretrained(
    "runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16, use_safetensors=True
).to("cuda")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"

image = pipeline(prompt, num_inference_steps=25).images[0]

Check out the tutorial to learn how to use this API!

AutoPipeline supports text-to-image, image-to-image, and inpainting for the following diffusion models:

AutoPipelineForText2Image

class diffusers.AutoPipelineForText2Image

( *args**kwargs )

This class cannot be instantiated using __init__() (throws an error).

Class attributes:

  • config_name (str) β€” The configuration filename that stores the class and module names of all the diffusion pipeline’s components.

from_pretrained

( pretrained_model_or_path**kwargs )

Parameters

  • pretrained_model_name_or_path (str or os.PathLike, optional) β€” Can be either:

    • A string, the repo id (for example CompVis/ldm-text2im-large-256) of a pretrained pipeline hosted on the Hub.

  • torch_dtype (str or torch.dtype, optional) β€” Override the default torch.dtype and load the model with another dtype. If β€œauto” is passed, the dtype is automatically derived from the model’s weights.

  • 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.

  • 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.

  • 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.

  • custom_revision (str, optional, defaults to "main") β€” The specific model version to use. It can be a branch name, a tag name, or a commit id similar to revision when loading a custom pipeline from the Hub. It can be a 🌍 Diffusers version when loading a custom pipeline from GitHub, otherwise it defaults to "main" when loading from the Hub.

  • mirror (str, optional) β€” Mirror source to resolve accessibility issues if you’re downloading a model in China. We do not guarantee the timeliness or safety of the source, and you should refer to the mirror site for more information.

  • device_map (str or Dict[str, Union[int, str, torch.device]], optional) β€” A map that specifies where each submodule should go. It doesn’t need to be defined for each parameter/buffer name; once a given module name is inside, every submodule of it will be sent to the same device.

  • max_memory (Dict, optional) β€” A dictionary device identifier for the maximum memory. Will default to the maximum memory available for each GPU and the available CPU RAM if unset.

  • offload_folder (str or os.PathLike, optional) β€” The path to offload weights if device_map contains the value "disk".

  • offload_state_dict (bool, optional) β€” If True, temporarily offloads the CPU state dict to the hard drive to avoid running out of CPU RAM if the weight of the CPU state dict + the biggest shard of the checkpoint does not fit. Defaults to True when there is some disk offload.

  • low_cpu_mem_usage (bool, optional, defaults to True if torch version >= 1.9.0 else False) β€” Speed up model loading only loading the pretrained weights and not initializing the weights. This also tries to not use more than 1x model size in CPU memory (including peak memory) while loading the model. Only supported for PyTorch >= 1.9.0. If you are using an older version of PyTorch, setting this argument to True will raise an error.

  • use_safetensors (bool, optional, defaults to None) β€” If set to None, the safetensors weights are downloaded if they’re available and if the safetensors library is installed. If set to True, the model is forcibly loaded from safetensors weights. If set to False, safetensors weights are not loaded.

  • kwargs (remaining dictionary of keyword arguments, optional) β€” Can be used to overwrite load and saveable variables (the pipeline components of the specific pipeline class). The overwritten components are passed directly to the pipelines __init__ method. See example below for more information.

  • variant (str, optional) β€” Load weights from a specified variant filename such as "fp16" or "ema". This is ignored when loading from_flax.

Instantiates a text-to-image Pytorch diffusion pipeline from pretrained pipeline weight.

The from_pretrained() method takes care of returning the correct pipeline class instance by:

  1. Detect the pipeline class of the pretrained_model_or_path based on the _class_name property of its config object

  2. Find the text-to-image pipeline linked to the pipeline class using pattern matching on pipeline class name.

The pipeline is set in evaluation mode (model.eval()) by default.

If you get the error message below, you need to finetune the weights for your downstream task:

Copied

Some weights of UNet2DConditionModel were not initialized from the model checkpoint at runwayml/stable-diffusion-v1-5 and are newly initialized because the shapes did not match:
- conv_in.weight: found shape torch.Size([320, 4, 3, 3]) in the checkpoint and torch.Size([320, 9, 3, 3]) in the model instantiated
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.

Examples:

Copied

>>> from diffusers import AutoPipelineForText2Image

>>> pipeline = AutoPipelineForText2Image.from_pretrained("runwayml/stable-diffusion-v1-5")
>>> image = pipeline(prompt).images[0]

from_pipe

( pipeline**kwargs )

Parameters

  • pipeline (DiffusionPipeline) β€” an instantiated DiffusionPipeline object

Instantiates a text-to-image Pytorch diffusion pipeline from another instantiated diffusion pipeline class.

The from_pipe() method takes care of returning the correct pipeline class instance by finding the text-to-image pipeline linked to the pipeline class using pattern matching on pipeline class name.

All the modules the pipeline contains will be used to initialize the new pipeline without reallocating additional memoery.

The pipeline is set in evaluation mode (model.eval()) by default.

Copied

>>> from diffusers import AutoPipelineForText2Image, AutoPipelineForImage2Image

>>> pipe_i2i = AutoPipelineForImage2Image.from_pretrained(
...     "runwayml/stable-diffusion-v1-5", requires_safety_checker=False
... )

>>> pipe_t2i = AutoPipelineForText2Image.from_pipe(pipe_i2i)
>>> image = pipe_t2i(prompt).images[0]

AutoPipelineForImage2Image

class diffusers.AutoPipelineForImage2Image

( *args**kwargs )

This class cannot be instantiated using __init__() (throws an error).

Class attributes:

  • config_name (str) β€” The configuration filename that stores the class and module names of all the diffusion pipeline’s components.

from_pretrained

( pretrained_model_or_path**kwargs )

Parameters

  • pretrained_model_name_or_path (str or os.PathLike, optional) β€” Can be either:

    • A string, the repo id (for example CompVis/ldm-text2im-large-256) of a pretrained pipeline hosted on the Hub.

  • torch_dtype (str or torch.dtype, optional) β€” Override the default torch.dtype and load the model with another dtype. If β€œauto” is passed, the dtype is automatically derived from the model’s weights.

  • 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.

  • 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.

  • 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.

  • custom_revision (str, optional, defaults to "main") β€” The specific model version to use. It can be a branch name, a tag name, or a commit id similar to revision when loading a custom pipeline from the Hub. It can be a 🌍 Diffusers version when loading a custom pipeline from GitHub, otherwise it defaults to "main" when loading from the Hub.

  • mirror (str, optional) β€” Mirror source to resolve accessibility issues if you’re downloading a model in China. We do not guarantee the timeliness or safety of the source, and you should refer to the mirror site for more information.

  • device_map (str or Dict[str, Union[int, str, torch.device]], optional) β€” A map that specifies where each submodule should go. It doesn’t need to be defined for each parameter/buffer name; once a given module name is inside, every submodule of it will be sent to the same device.

  • max_memory (Dict, optional) β€” A dictionary device identifier for the maximum memory. Will default to the maximum memory available for each GPU and the available CPU RAM if unset.

  • offload_folder (str or os.PathLike, optional) β€” The path to offload weights if device_map contains the value "disk".

  • offload_state_dict (bool, optional) β€” If True, temporarily offloads the CPU state dict to the hard drive to avoid running out of CPU RAM if the weight of the CPU state dict + the biggest shard of the checkpoint does not fit. Defaults to True when there is some disk offload.

  • low_cpu_mem_usage (bool, optional, defaults to True if torch version >= 1.9.0 else False) β€” Speed up model loading only loading the pretrained weights and not initializing the weights. This also tries to not use more than 1x model size in CPU memory (including peak memory) while loading the model. Only supported for PyTorch >= 1.9.0. If you are using an older version of PyTorch, setting this argument to True will raise an error.

  • use_safetensors (bool, optional, defaults to None) β€” If set to None, the safetensors weights are downloaded if they’re available and if the safetensors library is installed. If set to True, the model is forcibly loaded from safetensors weights. If set to False, safetensors weights are not loaded.

  • kwargs (remaining dictionary of keyword arguments, optional) β€” Can be used to overwrite load and saveable variables (the pipeline components of the specific pipeline class). The overwritten components are passed directly to the pipelines __init__ method. See example below for more information.

  • variant (str, optional) β€” Load weights from a specified variant filename such as "fp16" or "ema". This is ignored when loading from_flax.

Instantiates a image-to-image Pytorch diffusion pipeline from pretrained pipeline weight.

The from_pretrained() method takes care of returning the correct pipeline class instance by:

  1. Detect the pipeline class of the pretrained_model_or_path based on the _class_name property of its config object

  2. Find the image-to-image pipeline linked to the pipeline class using pattern matching on pipeline class name.

The pipeline is set in evaluation mode (model.eval()) by default.

If you get the error message below, you need to finetune the weights for your downstream task:

Copied

Some weights of UNet2DConditionModel were not initialized from the model checkpoint at runwayml/stable-diffusion-v1-5 and are newly initialized because the shapes did not match:
- conv_in.weight: found shape torch.Size([320, 4, 3, 3]) in the checkpoint and torch.Size([320, 9, 3, 3]) in the model instantiated
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.

Examples:

Copied

>>> from diffusers import AutoPipelineForImage2Image

>>> pipeline = AutoPipelineForImage2Image.from_pretrained("runwayml/stable-diffusion-v1-5")
>>> image = pipeline(prompt, image).images[0]

from_pipe

( pipeline**kwargs )

Parameters

  • pipeline (DiffusionPipeline) β€” an instantiated DiffusionPipeline object

Instantiates a image-to-image Pytorch diffusion pipeline from another instantiated diffusion pipeline class.

The from_pipe() method takes care of returning the correct pipeline class instance by finding the image-to-image pipeline linked to the pipeline class using pattern matching on pipeline class name.

All the modules the pipeline contains will be used to initialize the new pipeline without reallocating additional memoery.

The pipeline is set in evaluation mode (model.eval()) by default.

Examples:

Copied

>>> from diffusers import AutoPipelineForText2Image, AutoPipelineForImage2Image

>>> pipe_t2i = AutoPipelineForText2Image.from_pretrained(
...     "runwayml/stable-diffusion-v1-5", requires_safety_checker=False
... )

>>> pipe_i2i = AutoPipelineForImage2Image.from_pipe(pipe_t2i)
>>> image = pipe_i2i(prompt, image).images[0]

AutoPipelineForInpainting

class diffusers.AutoPipelineForInpainting

( *args**kwargs )

This class cannot be instantiated using __init__() (throws an error).

Class attributes:

  • config_name (str) β€” The configuration filename that stores the class and module names of all the diffusion pipeline’s components.

from_pretrained

( pretrained_model_or_path**kwargs )

Parameters

  • pretrained_model_name_or_path (str or os.PathLike, optional) β€” Can be either:

    • A string, the repo id (for example CompVis/ldm-text2im-large-256) of a pretrained pipeline hosted on the Hub.

  • torch_dtype (str or torch.dtype, optional) β€” Override the default torch.dtype and load the model with another dtype. If β€œauto” is passed, the dtype is automatically derived from the model’s weights.

  • 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.

  • 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.

  • 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.

  • custom_revision (str, optional, defaults to "main") β€” The specific model version to use. It can be a branch name, a tag name, or a commit id similar to revision when loading a custom pipeline from the Hub. It can be a 🌍 Diffusers version when loading a custom pipeline from GitHub, otherwise it defaults to "main" when loading from the Hub.

  • mirror (str, optional) β€” Mirror source to resolve accessibility issues if you’re downloading a model in China. We do not guarantee the timeliness or safety of the source, and you should refer to the mirror site for more information.

  • device_map (str or Dict[str, Union[int, str, torch.device]], optional) β€” A map that specifies where each submodule should go. It doesn’t need to be defined for each parameter/buffer name; once a given module name is inside, every submodule of it will be sent to the same device.

  • max_memory (Dict, optional) β€” A dictionary device identifier for the maximum memory. Will default to the maximum memory available for each GPU and the available CPU RAM if unset.

  • offload_folder (str or os.PathLike, optional) β€” The path to offload weights if device_map contains the value "disk".

  • offload_state_dict (bool, optional) β€” If True, temporarily offloads the CPU state dict to the hard drive to avoid running out of CPU RAM if the weight of the CPU state dict + the biggest shard of the checkpoint does not fit. Defaults to True when there is some disk offload.

  • low_cpu_mem_usage (bool, optional, defaults to True if torch version >= 1.9.0 else False) β€” Speed up model loading only loading the pretrained weights and not initializing the weights. This also tries to not use more than 1x model size in CPU memory (including peak memory) while loading the model. Only supported for PyTorch >= 1.9.0. If you are using an older version of PyTorch, setting this argument to True will raise an error.

  • use_safetensors (bool, optional, defaults to None) β€” If set to None, the safetensors weights are downloaded if they’re available and if the safetensors library is installed. If set to True, the model is forcibly loaded from safetensors weights. If set to False, safetensors weights are not loaded.

  • kwargs (remaining dictionary of keyword arguments, optional) β€” Can be used to overwrite load and saveable variables (the pipeline components of the specific pipeline class). The overwritten components are passed directly to the pipelines __init__ method. See example below for more information.

  • variant (str, optional) β€” Load weights from a specified variant filename such as "fp16" or "ema". This is ignored when loading from_flax.

Instantiates a inpainting Pytorch diffusion pipeline from pretrained pipeline weight.

The from_pretrained() method takes care of returning the correct pipeline class instance by:

  1. Detect the pipeline class of the pretrained_model_or_path based on the _class_name property of its config object

  2. Find the inpainting pipeline linked to the pipeline class using pattern matching on pipeline class name.

The pipeline is set in evaluation mode (model.eval()) by default.

If you get the error message below, you need to finetune the weights for your downstream task:

Copied

Some weights of UNet2DConditionModel were not initialized from the model checkpoint at runwayml/stable-diffusion-v1-5 and are newly initialized because the shapes did not match:
- conv_in.weight: found shape torch.Size([320, 4, 3, 3]) in the checkpoint and torch.Size([320, 9, 3, 3]) in the model instantiated
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.

Examples:

Copied

>>> from diffusers import AutoPipelineForInpainting

>>> pipeline = AutoPipelineForInpainting.from_pretrained("runwayml/stable-diffusion-v1-5")
>>> image = pipeline(prompt, image=init_image, mask_image=mask_image).images[0]

from_pipe

( pipeline**kwargs )

Parameters

  • pipeline (DiffusionPipeline) β€” an instantiated DiffusionPipeline object

Instantiates a inpainting Pytorch diffusion pipeline from another instantiated diffusion pipeline class.

The from_pipe() method takes care of returning the correct pipeline class instance by finding the inpainting pipeline linked to the pipeline class using pattern matching on pipeline class name.

All the modules the pipeline class contain will be used to initialize the new pipeline without reallocating additional memoery.

The pipeline is set in evaluation mode (model.eval()) by default.

Examples:

Copied

>>> from diffusers import AutoPipelineForText2Image, AutoPipelineForInpainting

>>> pipe_t2i = AutoPipelineForText2Image.from_pretrained(
...     "DeepFloyd/IF-I-XL-v1.0", requires_safety_checker=False
... )

>>> pipe_inpaint = AutoPipelineForInpainting.from_pipe(pipe_t2i)
>>> image = pipe_inpaint(prompt, image=init_image, mask_image=mask_image).images[0]

is a generic pipeline class that instantiates a text-to-image pipeline class. The specific underlying pipeline class is automatically selected from either the or methods.

A path to a directory (for example ./my_pipeline_directory/) containing pipeline weights saved using .

Set device_map="auto" to have 🌍 Accelerate automatically compute the most optimized device_map. For more information about each option see .

If a controlnet argument is passed, it will instantiate a object.

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

is a generic pipeline class that instantiates an image-to-image pipeline class. The specific underlying pipeline class is automatically selected from either the or methods.

A path to a directory (for example ./my_pipeline_directory/) containing pipeline weights saved using .

Set device_map="auto" to have 🌍 Accelerate automatically compute the most optimized device_map. For more information about each option see .

If a controlnet argument is passed, it will instantiate a object.

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

is a generic pipeline class that instantiates an inpainting pipeline class. The specific underlying pipeline class is automatically selected from either the or methods.

A path to a directory (for example ./my_pipeline_directory/) containing pipeline weights saved using .

Set device_map="auto" to have 🌍 Accelerate automatically compute the most optimized device_map. For more information about each option see .

If a controlnet argument is passed, it will instantiate a object.

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

🌍
🌍
AutoPipeline
Stable Diffusion
ControlNet
Stable Diffusion XL (SDXL)
DeepFloyd IF
Kandinsky
Kandinsky 2.2
<source>
AutoPipelineForText2Image
from_pretrained()
from_pipe()
<source>
save_pretrained()
designing a device map
StableDiffusionControlNetPipeline
gated
<source>
<source>
AutoPipelineForImage2Image
from_pretrained()
from_pipe()
<source>
save_pretrained()
designing a device map
StableDiffusionControlNetImg2ImgPipeline
gated
<source>
<source>
AutoPipelineForInpainting
from_pretrained()
from_pipe()
<source>
save_pretrained()
designing a device map
StableDiffusionControlNetInpaintPipeline
gated
<source>