Buckets:

hf-doc-build/doc / diffusers /main /ar /api /models /autoencoder_kl_kvae.md
mishig's picture
|
download
raw
6.01 kB

AutoencoderKLKVAE

نموذج الترميز التلقائي التبايني ثنائي الأبعاد (VAE) مع خسارة كولباك-ليبلر.

يمكن تحميل النموذج باستخدام مقتطف الشيفرة التالي.

import torch
from diffusers import AutoencoderKLKVAE

vae = AutoencoderKLKVAE.from_pretrained("kandinskylab/KVAE-2D-1.0", subfolder="diffusers", dtype=torch.bfloat16)

AutoencoderKLKVAE[[diffusers.AutoencoderKLKVAE]]

diffusers.AutoencoderKLKVAE[[diffusers.AutoencoderKLKVAE]]

diffusers.AutoencoderKLKVAE(in_channels: int = 3, channels: int = 128, num_enc_blocks: int = 2, num_dec_blocks: int = 2, z_channels: int = 16, double_z: bool = True, ch_mult: typing.Tuple[int, ...] = (1, 2, 4, 8), sample_size: int = 1024)

المصدر

المعاملات:

in_channels (int, اختياري، القيمة الافتراضية 3) : عدد القنوات في الصورة المدخلة.

channels (int، اختياري، القيمة الافتراضية 128) : العدد الأساسي للقنوات في كتل تعدد الدقة.

num_enc_blocks (int, اختياري, القيمة الافتراضية 2) : عدد كتل Resnet في طبقات تعدد الدقة في المُشفِّر.

num_dec_blocks (int, اختياري, القيمة الافتراضية 2) : عدد كتل Resnet في طبقات تعدد الدقة في المُفكِّك.

z_channels (int، اختياري، القيمة الافتراضية 16) : عدد القنوات في الفضاء الكامن.

double_z (bool، اختياري، القيمة الافتراضية True) : ما إذا كان يجب مضاعفة عدد قنوات المخرج في المُشفِّر.

ch_mult (Tuple[int, ...]، اختياري، الافتراضي (1, 2, 4, 8)) : مضاعفات القنوات في كتل تعدد الدقة.

sample_size (int، اختياري، القيمة الافتراضية 1024) : حجم الإدخال العينة.

نموذج VAE مع خسارة KL لتشفير الصور إلى كامنات وفك تمثيل الكامنات إلى صور.

يرث هذا النموذج من ModelMixin. راجع توثيق الفئة الأصلية لمعرفة طرقها العامة المُنفَّذة لجميع النماذج (مثل التنزيل أو الحفظ).

فك الترميز[[diffusers.AutoencoderKLKVAE.decode]]

decode(z: FloatTensor, return_dict: bool = True, generator = None)

المصدر

المعاملات:

z (torch.Tensor) : دفعة إدخال من المتجهات الكامنة.

return_dict (bool، اختياري، القيمة الافتراضية True) : ما إذا كان يجب إرجاع ~models.vae.DecoderOutput بدلاً من tuple عادي.

يعيد: ~models.vae.DecoderOutput أو tuple

If return_dict is True, a ~models.vae.DecoderOutput is returned, otherwise a plain tuple is returned.

فكّ تشفير دفعة من الصور.

ترميز[[diffusers.AutoencoderKLKVAE.encode]]

encode(x: Tensor, return_dict: bool = True)

المصدر

المعاملات:

x (torch.Tensor) : دفعة من الصور المدخلة.

return_dict (bool، اختياري، الافتراضي True) : ما إذا كان يجب إرجاع ~models.autoencoder_kl.AutoencoderKLOutput بدلاً من tuple عادي.

يعيد:

تمثيلات الكامنة للصور المُرمّزة. إذا كان return_dict صحيحًا (True)، يُعاد ~models.autoencoder_kl.AutoencoderKLOutput، وإلا يُعاد tuple عادي.

ترميز دفعة من الصور إلى كامنات.

forward[[diffusers.AutoencoderKLKVAE.forward]]

forward(sample: Tensor, sample_posterior: bool = False, return_dict: bool = True, generator: typing.Optional[torch.Generator] = None)

المصدر

المعاملات:

sample (torch.Tensor) : عينة الإدخال.

sample_posterior (bool، اختياري، الافتراضي False) : ما إذا كان سيتم أخذ عينة من التوزيع اللاحق.

return_dict (bool، اختياري، الافتراضي True) : ما إذا كان يجب إرجاع DecoderOutput بدلاً من tuple عادي.

generator (torch.Generator، اختياري) : torch.Generator لجعل عملية أخذ العينات حتمية.

يعيد: ~models.vae.DecoderOutput أو tuple

إذا كان return_dict صحيحًا، يُعاد ~models.vae.DecoderOutput، وإلا يُعاد tuple عادي.

tiled_decode[[diffusers.AutoencoderKLKVAE.tiled_decode]]

tiled_decode(z: Tensor, return_dict: bool = True)

المصدر

المعاملات:

z (torch.Tensor) : دفعة إدخال من المتجهات الكامنة.

return_dict (bool، اختياري، القيمة الافتراضية True) : ما إذا كان يجب إرجاع ~models.vae.DecoderOutput بدلاً من tuple عادي.

يعيد: ~models.vae.DecoderOutput أو tuple

If return_dict is True, a ~models.vae.DecoderOutput is returned, otherwise a plain tuple is returned.

فكّ تشفير دفعة من الصور باستخدام مُفكّك مُجزّأ.

Xet Storage Details

Size:
6.01 kB
·
Xet hash:
d8c773341bb2db8a06893860e23dae0a116babe368cbb603536ae1c496e4e1d0

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