Buckets:
| # 输出 | |
| 所有模型输出都是 [BaseOutput](/docs/diffusers/v0.43.0/zh/api/outputs#diffusers.utils.BaseOutput) 的子类,这是一种包含模型返回的所有信息的数据结构。这些输出也可以作为元组或字典使用。 | |
| 例如: | |
| ```python | |
| from diffusers import DDIMPipeline | |
| pipeline = DDIMPipeline.from_pretrained("google/ddpm-cifar10-32") | |
| outputs = pipeline() | |
| ``` | |
| `outputs` 对象是一个 [ImagePipelineOutput](/docs/diffusers/v0.43.0/zh/api/pipelines/consistency_models#diffusers.ImagePipelineOutput),这意味着它具有 image 属性。 | |
| 您可以像往常一样访问每个属性,也可以通过关键字查找来访问;如果该属性未被模型返回,您将得到 `None`: | |
| ```python | |
| outputs.images | |
| outputs["images"] | |
| ``` | |
| 将 `outputs` 对象视为元组时,它仅考虑那些值不为 `None` 的属性。例如,通过索引获取图像会返回元组 `(outputs.images)`: | |
| ```python | |
| outputs[:1] | |
| ``` | |
| > [!TIP] | |
| > 要查看特定流水线或模型的输出,请参阅其对应的 API 文档。 | |
| ## BaseOutput[[diffusers.utils.BaseOutput]] | |
| #### diffusers.utils.BaseOutput[[diffusers.utils.BaseOutput]] | |
| [源代码](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/utils/outputs.py#L40) | |
| 所有模型输出的基类,以 dataclass 形式实现。具有 `__getitem__` 方法,支持通过整数或切片(类似元组)或字符串(类似字典)进行索引,且会忽略 `None` 属性。其他行为与普通 Python 字典一致。 | |
| > [!WARNING] > 无法直接解包 `BaseOutput`。请使用 [to_tuple()](/docs/diffusers/v0.43.0/zh/api/outputs#diffusers.utils.BaseOutput.to_tuple) 方法进行转换 | |
| 将其转换为元组 > 首先。 | |
| #### to_tuple[[diffusers.utils.BaseOutput.to_tuple]] | |
| ```python | |
| to_tuple() | |
| ``` | |
| [源代码](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/utils/outputs.py#L123) | |
| 将 self 转换为一个元组,其中包含所有不为 `None` 的属性/键。 | |
| ## ImagePipelineOutput[[diffusers.ImagePipelineOutput]] | |
| #### diffusers.ImagePipelineOutput[[diffusers.ImagePipelineOutput]] | |
| ```python | |
| diffusers.ImagePipelineOutput(images: list[PIL.Image.Image] | numpy.ndarray) | |
| ``` | |
| [源代码](https://github.com/huggingface/diffusers/blob/v0.43.0/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/v0.43.0/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/v0.43.0/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:
- 3.86 kB
- Xet hash:
- deaaafbf6fcc0d798851ec78023efbb7937d4e9425ab503f2b39be1e99abab9e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.