Buckets:

mishig's picture
|
download
raw
4.49 kB
# 出力
すべてのモデルの出力は、モデルが返すすべての情報を含むデータ構造である[BaseOutput](/docs/diffusers/main/ja/api/outputs#diffusers.utils.BaseOutput)のサブクラスです。出力は、タプルや辞書としても使用できます。
例えば:
```python
from diffusers import DDIMPipeline
pipeline = DDIMPipeline.from_pretrained("google/ddpm-cifar10-32")
outputs = pipeline()
```
`outputs` オブジェクトは [ImagePipelineOutput](/docs/diffusers/main/ja/api/pipelines/consistency_models#diffusers.ImagePipelineOutput) であり、image 属性を持つことを意味します。
各属性は、通常の方法やキーワード検索によってアクセスできます。モデルによって返されない属性の場合、`None`が返されます。
```python
outputs.images
outputs["images"]
```
`outputs`オブジェクトをタプルとして扱う場合、`None`の値を持たない属性のみが対象となります。例えば、インデックスで画像を取得すると、タプル`(outputs.images)`が返されます。
```python
outputs[:1]
```
> [!TIP]
> 特定のpipelineまたはモデルの出力を確認するには、それぞれのAPIドキュメントを参照してください。
## BaseOutput[[diffusers.utils.BaseOutput]]
#### diffusers.utils.BaseOutput[[diffusers.utils.BaseOutput]]
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/outputs.py#L40)
すべてのモデル出力の基底クラスであり、dataclass として実装されています。`__getitem__` を備えており、整数やスライス(タプルと同様)または文字列(辞書と同様)によるインデックス指定が可能です。この際、`None` 属性は無視されます。それ以外の動作は、通常の Python 辞書と同様です。
> [!WARNING] > `BaseOutput` を直接アンパックすることはできません。[to_tuple()](/docs/diffusers/main/ja/api/outputs#diffusers.utils.BaseOutput.to_tuple) メソッドを使用して変換してください
it をタプル > 最初に。
#### to_tuple[[diffusers.utils.BaseOutput.to_tuple]]
```python
to_tuple()
```
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/outputs.py#L123)
`None` 以外のすべての属性/キーを含むタプルに self を変換します。
## ImagePipelineOutput[[diffusers.ImagePipelineOutput]]
#### diffusers.ImagePipelineOutput[[diffusers.ImagePipelineOutput]]
```python
diffusers.ImagePipelineOutput(images: list[PIL.Image.Image] | numpy.ndarray)
```
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L135)
**パラメータ:**
images (`List[PIL.Image.Image]` または `np.ndarray`) : 長さ `batch_size` のデノイズ済み PIL 画像のリスト、または形状 `(batch_size, height, width, num_channels)` の NumPy 配列。
画像パイプライン用の出力クラス。
## AudioPipelineOutput[[diffusers.AudioPipelineOutput]]
#### diffusers.AudioPipelineOutput[[diffusers.AudioPipelineOutput]]
```python
diffusers.AudioPipelineOutput(audios: ndarray)
```
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/pipeline_utils.py#L149)
**パラメータ:**
audios (`np.ndarray`) : 形状が `(batch_size, num_channels, sample_rate)` の NumPy 配列のデノイズ済みオーディオサンプルのリスト。
音声パイプライン用の出力クラス。
## ImageTextPipelineOutput[[diffusers.ImageTextPipelineOutput]]
#### diffusers.ImageTextPipelineOutput[[diffusers.ImageTextPipelineOutput]]
```python
diffusers.ImageTextPipelineOutput(images: list[PIL.Image.Image] | numpy.ndarray | None, text: list[str] | list[list[str]] | None)
```
[ソース](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/deprecated/unidiffuser/pipeline_unidiffuser.py#L48)
**パラメータ:**
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` である文字列のリストのリスト。
画像とテキストのジョイントパイプライン用の出力クラス。

Xet Storage Details

Size:
4.49 kB
·
Xet hash:
aea53be21ea93faeebc1ec1a813961ef2569c3c8803637853bf9654f8bfe42d7

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.