Buckets:
| # Decoder Konsistensi | |
| Consistency decoder dapat digunakan untuk mendekode latents dari denoising UNet dalam [StableDiffusionPipeline](/docs/diffusers/main/id/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline). Decoder ini diperkenalkan dalam [laporan teknis DALL-E 3](https://openai.com/dall-e-3). | |
| Kodebase asli dapat ditemukan di [openai/consistencydecoder](https://github.com/openai/consistencydecoder). | |
| > [!WARNING] | |
| > Inference saat ini hanya didukung untuk 2 iterasi. | |
| Pipeline ini tidak akan dapat disumbangkan tanpa bantuan dari [madebyollin](https://github.com/madebyollin) dan [mrsteyk](https://github.com/mrsteyk) dari [isu ini](https://github.com/openai/consistencydecoder/issues/1). | |
| ## ConsistencyDecoderVAE[[diffusers.ConsistencyDecoderVAE]] | |
| #### diffusers.ConsistencyDecoderVAE[[diffusers.ConsistencyDecoderVAE]] | |
| ```python | |
| diffusers.ConsistencyDecoderVAE(scaling_factor: float = 0.18215, latent_channels: int = 4, sample_size: int = 32, encoder_act_fn: str = 'silu', encoder_block_out_channels: tuple[int, ...] = (128, 256, 512, 512), encoder_double_z: bool = True, encoder_down_block_types: tuple[str, ...] = ('DownEncoderBlock2D', 'DownEncoderBlock2D', 'DownEncoderBlock2D', 'DownEncoderBlock2D'), encoder_in_channels: int = 3, encoder_layers_per_block: int = 2, encoder_norm_num_groups: int = 32, encoder_out_channels: int = 4, decoder_add_attention: bool = False, decoder_block_out_channels: tuple[int, ...] = (320, 640, 1024, 1024), decoder_down_block_types: tuple[str, ...] = ('ResnetDownsampleBlock2D', 'ResnetDownsampleBlock2D', 'ResnetDownsampleBlock2D', 'ResnetDownsampleBlock2D'), decoder_downsample_padding: int = 1, decoder_in_channels: int = 7, decoder_layers_per_block: int = 3, decoder_norm_eps: float = 1e-05, decoder_norm_num_groups: int = 32, decoder_num_train_timesteps: int = 1024, decoder_out_channels: int = 6, decoder_resnet_time_scale_shift: str = 'scale_shift', decoder_time_embedding_type: str = 'learned', decoder_up_block_types: tuple[str, ...] = ('ResnetUpsampleBlock2D', 'ResnetUpsampleBlock2D', 'ResnetUpsampleBlock2D', 'ResnetUpsampleBlock2D')) | |
| ``` | |
| [Sumber](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/consistency_decoder_vae.py#L51) | |
| Decoder konsistensi yang digunakan dengan DALL-E 3. | |
| Contoh: | |
| ```py | |
| >>> import torch | |
| >>> from diffusers import StableDiffusionPipeline, ConsistencyDecoderVAE | |
| >>> vae = ConsistencyDecoderVAE.from_pretrained("openai/consistency-decoder", torch_dtype=torch.float16) | |
| >>> pipe = StableDiffusionPipeline.from_pretrained( | |
| ... "stable-diffusion-v1-5/stable-diffusion-v1-5", vae=vae, torch_dtype=torch.float16 | |
| ... ).to("cuda") | |
| >>> image = pipe("horse", generator=torch.manual_seed(0)).images[0] | |
| >>> image | |
| ``` | |
| #### decode[[diffusers.ConsistencyDecoderVAE.decode]] | |
| ```python | |
| decode(z: Tensor, generator: typing.Optional[torch.Generator] = None, return_dict: bool = True, num_inference_steps: int = 2) | |
| ``` | |
| [Sumber](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/consistency_decoder_vae.py#L220) | |
| **Parameter:** | |
| z (torch.Tensor) : Vektor laten input. | |
| generator (torch.Generator | None) : Generator bilangan acak. Default adalah None. | |
| return_dict (bool) : Apakah mengembalikan output sebagai kamus. Default adalah True. | |
| num_inference_steps (int) : Jumlah langkah inferensi. Default adalah 2. | |
| **Mengembalikan:** DecoderOutput | tuple[torch.Tensor] | |
| Output yang telah didekodekan. | |
| Mendekode vektor laten input `z` menggunakan model VAE konsistensi decoder. | |
| #### encode[[diffusers.ConsistencyDecoderVAE.encode]] | |
| ```python | |
| encode(x: Tensor, return_dict: bool = True) | |
| ``` | |
| [Sumber](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/consistency_decoder_vae.py#L185) | |
| **Parameter:** | |
| x (`torch.Tensor`) : Batch input gambar. | |
| return_dict (`bool`, *opsional*, defaultnya `True`) : Apakah akan mengembalikan `ConsistencyDecoderVAEOutput` alih-alih tuple biasa. | |
| **Mengembalikan:** | |
| Representasi laten dari gambar yang dikodekan. Jika `return_dict` bernilai True, sebuah `ConsistencyDecoderVAEOutput` dikembalikan, selain itu sebuah `tuple` polos yang dikembalikan. | |
| Enkodekan batch gambar menjadi latents. | |
| #### forward[[diffusers.ConsistencyDecoderVAE.forward]] | |
| ```python | |
| forward(sample: Tensor, sample_posterior: bool = False, return_dict: bool = True, generator: typing.Optional[torch.Generator] = None) | |
| ``` | |
| [Sumber](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/consistency_decoder_vae.py#L336) | |
| **Parameter:** | |
| sample (`torch.Tensor`) : Sampel input. | |
| sample_posterior (`bool`, *opsional*, defaultnya `False`) : Apakah akan melakukan sampling dari posterior. | |
| return_dict (`bool`, *opsional*, defaultnya `True`) : Apakah akan mengembalikan `DecoderOutput` alih-alih tuple biasa. | |
| generator (`torch.Generator`, *opsional*, default `None`) : Generator yang digunakan untuk sampling. | |
| **Mengembalikan:** `DecoderOutput` atau `tuple` | |
| If return_dict is True, a `DecoderOutput` is returned, otherwise a plain `tuple` is returned. | |
| #### set_default_attn_processor[[diffusers.ConsistencyDecoderVAE.set_default_attn_processor]] | |
| ```python | |
| set_default_attn_processor() | |
| ``` | |
| [Sumber](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/consistency_decoder_vae.py#L170) | |
| Menonaktifkan prosesor perhatian kustom dan mengatur implementasi perhatian default. | |
| #### tiled_encode[[diffusers.ConsistencyDecoderVAE.tiled_encode]] | |
| ```python | |
| tiled_encode(x: Tensor, return_dict: bool = True) | |
| ``` | |
| [Sumber](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/consistency_decoder_vae.py#L281) | |
| **Parameter:** | |
| x (`torch.Tensor`) : Batch input gambar. | |
| return_dict (`bool`, *opsional*, defaultnya `True`) : Apakah akan mengembalikan `ConsistencyDecoderVAEOutput` alih-alih tuple biasa. | |
| **Mengembalikan:** `ConsistencyDecoderVAEOutput` atau `tuple` | |
| If return_dict is True, a `ConsistencyDecoderVAEOutput` is returned, otherwise a plain `tuple` is returned. | |
| Enkodekan batch gambar menggunakan encoder bertile. | |
| Ketika opsi ini diaktifkan, VAE akan membagi tensor input menjadi ubin (tiles) untuk menghitung encoding dalam beberapa langkah. Hal ini berguna untuk menjaga penggunaan memori tetap konstan terlepas dari ukuran gambar. Hasil akhir dari encoding bertile berbeda dari encoding non-tile karena setiap ubin menggunakan encoder yang berbeda. Untuk menghindari artefak tiling, ubin-ubin tersebut saling tumpang tindih dan dicampur (blended) untuk membentuk output yang halus. Anda mungkin masih melihat perubahan berukuran ubin pada output, tetapi seharusnya jauh lebih tidak terlihat. | |
Xet Storage Details
- Size:
- 6.7 kB
- Xet hash:
- c2a048f875049b53e9657fbd4842bb372ca500bda44906bdb6ccfcc0d339eb48
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.