Outputs
Outputs
All models outputs are subclasses of BaseOutput, data structures containing all the information returned by the model. The outputs can also be used as tuples or dictionaries.
For example:
Copied
The outputs
object is a ImagePipelineOutput which means it has an image attribute.
You can access each attribute as you normally would or with a keyword lookup, and if that attribute is not returned by the model, you will get None
:
Copied
When considering the outputs
object as a tuple, it only considers the attributes that donβt have None
values. For instance, retrieving an image by indexing into it returns the tuple (outputs.images)
:
Copied
To check a specific pipeline or model output, refer to its corresponding API documentation.
BaseOutput
class diffusers.utils.BaseOutput
( )
Base class for all model outputs as dataclass. Has a __getitem__
that allows indexing by integer or slice (like a tuple) or strings (like a dictionary) that will ignore the None
attributes. Otherwise behaves like a regular Python dictionary.
You canβt unpack a BaseOutput
directly. Use the to_tuple() method to convert it to a tuple first.
to_tuple
( )
Convert self to a tuple containing all the attributes/keys that are not None
.
ImagePipelineOutput
class diffusers.ImagePipelineOutput
( images: typing.Union[typing.List[PIL.Image.Image], numpy.ndarray] )
Parameters
images (
List[PIL.Image.Image]
ornp.ndarray
) β List of denoised PIL images of lengthbatch_size
or NumPy array of shape(batch_size, height, width, num_channels)
.
Output class for image pipelines.
FlaxImagePipelineOutput
class diffusers.pipelines.pipeline_flax_utils.FlaxImagePipelineOutput
( images: typing.Union[typing.List[PIL.Image.Image], numpy.ndarray] )
Parameters
images (
List[PIL.Image.Image]
ornp.ndarray
) β List of denoised PIL images of lengthbatch_size
or NumPy array of shape(batch_size, height, width, num_channels)
.
Output class for image pipelines.
replace
( **updates )
βReturns a new object replacing the specified fields with new values.
AudioPipelineOutput
class diffusers.AudioPipelineOutput
( audios: ndarray )
Parameters
audios (
np.ndarray
) β List of denoised audio samples of a NumPy array of shape(batch_size, num_channels, sample_rate)
.
Output class for audio pipelines.
ImageTextPipelineOutput
class diffusers.ImageTextPipelineOutput
( images: typing.Union[typing.List[PIL.Image.Image], numpy.ndarray, NoneType]text: typing.Union[typing.List[str], typing.List[typing.List[str]], NoneType] )
Parameters
images (
List[PIL.Image.Image]
ornp.ndarray
) β List of denoised PIL images of lengthbatch_size
or NumPy array of shape(batch_size, height, width, num_channels)
.text (
List[str]
orList[List[str]]
) β List of generated text strings of lengthbatch_size
or a list of list of strings whose outer list has lengthbatch_size
.
Output class for joint image-text pipelines.
Last updated