Diffusers documentation

出力

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

出力

すべてのモデルの出力は、モデルが返すすべての情報を含むデータ構造であるBaseOutputのサブクラスです。出力は、タプルや辞書としても使用できます。

例えば:

from diffusers import DDIMPipeline

pipeline = DDIMPipeline.from_pretrained("google/ddpm-cifar10-32")
outputs = pipeline()

outputs オブジェクトは ImagePipelineOutput であり、image 属性を持つことを意味します。

各属性は、通常の方法やキーワード検索によってアクセスできます。モデルによって返されない属性の場合、Noneが返されます。

outputs.images
outputs["images"]

outputsオブジェクトをタプルとして扱う場合、Noneの値を持たない属性のみが対象となります。 例えば、インデックスで画像を取得すると、タプル(outputs.images)が返されます。

outputs[:1]

特定のpipelineまたはモデルの出力を確認するには、それぞれのAPIドキュメントを参照してください。

BaseOutput

class diffusers.utils.BaseOutput

< >

( )

すべてのモデル出力の基底クラスであり、dataclass として実装されています。__getitem__ を備えており、整数やスライス(タプルと同様)または文字列(辞書と同様)によるインデックス指定が可能です。この際、None の属性は無視されます。それ以外の動作は、通常の Python 辞書と同様です。

> BaseOutput を直接アンパックすることはできません。まず to_tuple() メソッドを使用してタプルに変換してください。

to_tuple

< >

( )

None 以外のすべての属性/キーを含むタプルに self を変換します。

ImagePipelineOutput

class diffusers.ImagePipelineOutput

< >

( images: list[PIL.Image.Image] | numpy.ndarray )

パラメータ

  • images (List[PIL.Image.Image] または np.ndarray) — batch_size 長さのデノイズ済み PIL 画像のリスト、または (batch_size, height, width, num_channels) の形状を持つ NumPy 配列です。

画像パイプライン用の出力クラス。

AudioPipelineOutput

class diffusers.AudioPipelineOutput

< >

( audios: ndarray )

パラメータ

  • audios (np.ndarray) — 形状が(batch_size, num_channels, sample_rate)のNumPy配列の、ノイズ除去済みオーディオサンプルのリスト。

音声パイプライン用の出力クラス。

ImageTextPipelineOutput

class diffusers.ImageTextPipelineOutput

< >

( images: list[PIL.Image.Image] | numpy.ndarray | Nonetext: list[str] | list[list[str]] | None )

パラメータ

  • images (list[PIL.Image.Image] または np.ndarray) — batch_size 個のノイズ除去済み PIL 画像のリスト、または形状が (batch_size, height, width, num_channels) の NumPy 配列。
  • text (list[str] または list[list[str]]) — 長さ batch_size の生成テキスト文字列のリスト、または外側のリストの長さが batch_size である文字列のリストのリスト。

画像とテキストのジョイントパイプライン用の出力クラス。

Update on GitHub