Buckets:
AutoencoderKLQwenImage
Mô hình có thể được tải bằng đoạn mã sau.
from diffusers import AutoencoderKLQwenImage
vae = AutoencoderKLQwenImage.from_pretrained("Qwen/QwenImage-20B", subfolder="vae")
AutoencoderKLQwenImage[[diffusers.AutoencoderKLQwenImage]]
diffusers.AutoencoderKLQwenImage[[diffusers.AutoencoderKLQwenImage]]
diffusers.AutoencoderKLQwenImage(base_dim: int = 96, 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, input_channels: int = 3, 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])
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.
Mô hình này kế thừa từ 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.AutoencoderKLQwenImage.decode]]
decode(z: Tensor, return_dict: bool = True)
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.
encode[[diffusers.AutoencoderKLQwenImage.encode]]
encode(x: Tensor, return_dict: bool = True)
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.
enable_tiling[[diffusers.AutoencoderKLQwenImage.enable_tiling]]
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)
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.
forward[[diffusers.AutoencoderKLQwenImage.forward]]
forward(sample: Tensor, sample_posterior: bool = False, return_dict: bool = True, generator: typing.Optional[torch.Generator] = None)
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 để 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.AutoencoderKLQwenImage.tiled_decode]]
tiled_decode(z: Tensor, return_dict: bool = True)
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.AutoencoderKLQwenImage.tiled_encode]]
tiled_encode(x: Tensor)
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.
AutoencoderKLOutput[[diffusers.models.modeling_outputs.AutoencoderKLOutput]]
diffusers.models.modeling_outputs.AutoencoderKLOutput[[diffusers.models.modeling_outputs.AutoencoderKLOutput]]
diffusers.models.modeling_outputs.AutoencoderKLOutput(latent_dist: DiagonalGaussianDistribution)
Tham số:
latent_dist (DiagonalGaussianDistribution) : Đầu ra được mã hóa của Encoder, được biểu diễn dưới dạng mean và logvar của DiagonalGaussianDistribution. DiagonalGaussianDistribution cho phép lấy mẫu các biến ẩn (latents) từ phân phối này.
Đầu ra của phương pháp mã hóa của AutoencoderKL.
DecoderOutput[[diffusers.models.autoencoders.vae.DecoderOutput]]
diffusers.models.autoencoders.vae.DecoderOutput[[diffusers.models.autoencoders.vae.DecoderOutput]]
diffusers.models.autoencoders.vae.DecoderOutput(sample: Tensor, commit_loss: typing.Optional[torch.FloatTensor] = None)
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:
- 8.42 kB
- Xet hash:
- 5b880781c082d23a84f6adcba8d15e77cd9b49b7da325dfc02c46ec87561f7b1
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.