Buckets:
| # AutoencoderKLWan | |
| Mô hình autoencoder biến phân 3D (VAE) với tổn thất KL được sử dụng trong [Wan 2.1](https://github.com/Wan-Video/Wan2.1) của nhóm Alibaba Wan. | |
| Mô hình có thể được tải bằng đoạn mã sau. | |
| ```python | |
| from diffusers import AutoencoderKLWan | |
| vae = AutoencoderKLWan.from_pretrained("Wan-AI/Wan2.1-T2V-1.3B-Diffusers", subfolder="vae", dtype=torch.float32) | |
| ``` | |
| ## AutoencoderKLWan[[diffusers.AutoencoderKLWan]] | |
| #### diffusers.AutoencoderKLWan[[diffusers.AutoencoderKLWan]] | |
| ```python | |
| diffusers.AutoencoderKLWan(base_dim: int = 96, decoder_base_dim: int | None = None, z_dim: int = 16, dim_mult: list[int] = [1, 2, 4, 4], num_res_blocks: int = 2, attn_scales: list[float] = [], temperal_downsample: list[bool] = [False, True, True], dropout: float = 0.0, latents_mean: list[float] = [-0.7571, -0.7089, -0.9113, 0.1075, -0.1745, 0.9653, -0.1517, 1.5508, 0.4134, -0.0715, 0.5517, -0.3632, -0.1922, -0.9497, 0.2503, -0.2921], latents_std: list[float] = [2.8184, 1.4541, 2.3275, 2.6558, 1.2196, 1.7708, 2.6052, 2.0743, 3.2687, 2.1526, 2.8652, 1.5579, 1.6382, 1.1253, 2.8251, 1.916], is_residual: bool = False, in_channels: int = 3, out_channels: int = 3, patch_size: int | None = None, scale_factor_temporal: int | None = 4, scale_factor_spatial: int | None = 8) | |
| ``` | |
| [Nguồn](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L964) | |
| Một mô hình VAE có tổn thất KL để mã hóa video thành các biến ẩn và giải mã các biểu diễn ẩn thành video. Được giới thiệu trong [Wan 2.1]. | |
| Mô hình này kế thừa từ [ModelMixin](/docs/diffusers/v0.43.0/vi/api/models/overview#diffusers.ModelMixin). Hãy xem tài liệu của lớp cha để biết các phương thức chung được triển khai cho tất cả các mô hình (chẳng hạn như tải xuống hoặc lưu trữ). | |
| #### decode[[diffusers.AutoencoderKLWan.decode]] | |
| ```python | |
| decode(z: Tensor, return_dict: bool = True) | |
| ``` | |
| [Nguồn](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1222) | |
| **Tham số:** | |
| z (`torch.Tensor`) : Lô đầu vào của các vector ẩn. | |
| return_dict (`bool`, *tùy chọn*, mặc định là `True`) : Có nên trả về một `~models.vae.DecoderOutput` thay vì một tuple thông thường hay không. | |
| **Trả về:** `~models.vae.DecoderOutput` hoặc `tuple` | |
| Nếu return_dict là True, một `~models.vae.DecoderOutput` sẽ được trả về, ngược lại một `tuple` thông thường sẽ được trả về. | |
| Giải mã một lô ảnh. | |
| #### enable_tiling[[diffusers.AutoencoderKLWan.enable_tiling]] | |
| ```python | |
| enable_tiling(tile_sample_min_height: int | None = None, tile_sample_min_width: int | None = None, tile_sample_stride_height: float | None = None, tile_sample_stride_width: float | None = None) | |
| ``` | |
| [Nguồn](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1097) | |
| **Tham số:** | |
| tile_sample_min_height (`int`, *optional*) : Chiều cao tối thiểu cần thiết để một mẫu được tách thành các ô (tiles) theo chiều cao. | |
| tile_sample_min_width (`int`, *optional*) : Độ rộng tối thiểu cần thiết để một mẫu được tách thành các ô (tiles) theo chiều rộng. | |
| tile_sample_stride_height (`int`, *optional*) : Lượng chồng lấn tối thiểu giữa hai gạch dọc liên tiếp. Điều này nhằm đảm bảo không có hiện tượng lỗi ghép gạch nào xảy ra dọc theo chiều cao. | |
| tile_sample_stride_width (`int`, *optional*) : Khoảng cách giữa hai ô gạch ngang liên tiếp. Điều này nhằm đảm bảo không có hiện tượng lỗi ghép gạch nào xảy ra dọc theo chiều rộng. | |
| Bật giải mã VAE dạng gạch. Khi tùy chọn này được bật, VAE sẽ chia tensor đầu vào thành các gạch để tính toán giải mã và mã hóa qua nhiều bước. Điều này hữu ích để tiết kiệm một lượng lớn bộ nhớ và cho phép xử lý các hình ảnh lớn hơn. | |
| #### encode[[diffusers.AutoencoderKLWan.encode]] | |
| ```python | |
| encode(x: Tensor, return_dict: bool = True) | |
| ``` | |
| [Nguồn](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1164) | |
| **Tham số:** | |
| x (`torch.Tensor`) : Lô đầu vào của các hình ảnh. | |
| return_dict (`bool`, *tùy chọn*, mặc định là `True`) : Có nên trả về một `~models.autoencoder_kl.AutoencoderKLOutput` thay vì một tuple thông thường hay không. | |
| **Trả về:** | |
| Các biểu diễn ẩn của các video đã được mã hóa. Nếu `return_dict` là True, một `~models.autoencoder_kl.AutoencoderKLOutput` sẽ được trả về, ngược lại một `tuple` thông thường sẽ được trả về. | |
| Mã hóa một lô ảnh thành các biến ẩn. | |
| #### forward[[diffusers.AutoencoderKLWan.forward]] | |
| ```python | |
| forward(sample: Tensor, sample_posterior: bool = False, return_dict: bool = True, generator: typing.Optional[torch.Generator] = None) | |
| ``` | |
| [Nguồn](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1413) | |
| **Tham số:** | |
| sample (`torch.Tensor`) : Mẫu đầu vào. | |
| sample_posterior (`bool`, *tùy chọn*, mặc định là `False`) : Có lấy mẫu từ phân phối hậu nghiệm hay không. | |
| return_dict (`bool`, *tùy chọn*, mặc định là `True`) : Có nên trả về một `DecoderOutput` thay vì một tuple thông thường hay không. | |
| generator (`torch.Generator`, *tùy chọn*) : Một [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html) để làm cho việc lấy mẫu trở nên tất định. | |
| **Trả về:** `~models.vae.DecoderOutput` hoặc `tuple` | |
| Nếu `return_dict` là True, một `~models.vae.DecoderOutput` sẽ được trả về, ngược lại một `tuple` thông thường sẽ được trả về. | |
| #### tiled_decode[[diffusers.AutoencoderKLWan.tiled_decode]] | |
| ```python | |
| tiled_decode(z: Tensor, return_dict: bool = True) | |
| ``` | |
| [Nguồn](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1335) | |
| **Tham số:** | |
| z (`torch.Tensor`) : Lô đầu vào của các vector ẩn. | |
| return_dict (`bool`, *tùy chọn*, mặc định là `True`) : Có nên trả về một `~models.vae.DecoderOutput` thay vì một tuple thông thường hay không. | |
| **Trả về:** `~models.vae.DecoderOutput` hoặc `tuple` | |
| Nếu return_dict là True, một `~models.vae.DecoderOutput` sẽ được trả về, ngược lại một `tuple` thông thường sẽ được trả về. | |
| Giải mã một lô ảnh bằng trình giải mã dạng gạch. | |
| #### tiled_encode[[diffusers.AutoencoderKLWan.tiled_encode]] | |
| ```python | |
| tiled_encode(x: Tensor) | |
| ``` | |
| [Nguồn](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/models/autoencoders/autoencoder_kl_wan.py#L1263) | |
| **Tham số:** | |
| x (`torch.Tensor`) : Lô đầu vào các video. | |
| **Trả về:** `torch.Tensor` | |
| Biểu diễn ẩn của các video đã được mã hóa. | |
| Mã hóa một lô ảnh bằng trình mã hóa dạng gạch. | |
| ## DecoderOutput[[diffusers.models.autoencoders.vae.DecoderOutput]] | |
| #### diffusers.models.autoencoders.vae.DecoderOutput[[diffusers.models.autoencoders.vae.DecoderOutput]] | |
| ```python | |
| diffusers.models.autoencoders.vae.DecoderOutput(sample: Tensor, commit_loss: typing.Optional[torch.FloatTensor] = None) | |
| ``` | |
| [Nguồn](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/models/autoencoders/vae.py#L49) | |
| **Tham số:** | |
| sample (`torch.Tensor` có shape `(batch_size, num_channels, height, width)`) : Mẫu đầu ra đã giải mã từ lớp cuối cùng của mô hình. | |
| Đầu ra của phương pháp giải mã. | |
Xet Storage Details
- Size:
- 7.97 kB
- Xet hash:
- 157bd2098644fb81d80815322b98d04539853d083067cf9555e265ee7b12db15
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.