Buckets:
| # Tiny AutoEncoder | |
| Stable Diffusion용 Tiny AutoEncoder(TAESD)는 Ollin Boer Bohan이 [madebyollin/taesd](https://github.com/madebyollin/taesd)에서 소개했습니다. 이는 Stable Diffusion의 VAE를 아주 작게 증류한 버전으로, [StableDiffusionPipeline](/docs/diffusers/main/ko/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline) 또는 [StableDiffusionXLPipeline](/docs/diffusers/main/ko/api/pipelines/stable_diffusion/stable_diffusion_xl#diffusers.StableDiffusionXLPipeline)의 latents를 거의 즉시 빠르게 디코딩할 수 있습니다. | |
| Stable Diffusion v-2.1과 함께 사용하려면: | |
| ```python | |
| import torch | |
| from diffusers import DiffusionPipeline, AutoencoderTiny | |
| pipe = DiffusionPipeline.from_pretrained( | |
| "stabilityai/stable-diffusion-2-1-base", dtype=torch.float16 | |
| ) | |
| pipe.vae = AutoencoderTiny.from_pretrained("madebyollin/taesd", dtype=torch.float16) | |
| pipe = pipe.to("cuda") # or "mps", "xpu", "cpu" | |
| prompt = "slice of delicious New York-style berry cheesecake" | |
| image = pipe(prompt, num_inference_steps=25).images[0] | |
| image | |
| ``` | |
| Stable Diffusion XL 1.0과 함께 사용하려면 | |
| ```python | |
| import torch | |
| from diffusers import DiffusionPipeline, AutoencoderTiny | |
| pipe = DiffusionPipeline.from_pretrained( | |
| "stabilityai/stable-diffusion-xl-base-1.0", dtype=torch.float16 | |
| ) | |
| pipe.vae = AutoencoderTiny.from_pretrained("madebyollin/taesdxl", dtype=torch.float16) | |
| pipe = pipe.to("cuda") # or "mps", "xpu", "cpu" | |
| prompt = "slice of delicious New York-style berry cheesecake" | |
| image = pipe(prompt, num_inference_steps=25).images[0] | |
| image | |
| ``` | |
| ## AutoencoderTiny[[diffusers.AutoencoderTiny]] | |
| #### diffusers.AutoencoderTiny[[diffusers.AutoencoderTiny]] | |
| ```python | |
| diffusers.AutoencoderTiny(in_channels: int = 3, out_channels: int = 3, encoder_block_out_channels: tuple = (64, 64, 64, 64), decoder_block_out_channels: tuple = (64, 64, 64, 64), act_fn: str = 'relu', upsample_fn: str = 'nearest', latent_channels: int = 4, upsampling_scaling_factor: int = 2, num_encoder_blocks: tuple = (1, 3, 3, 3), num_decoder_blocks: tuple = (3, 3, 3, 1), latent_magnitude: int = 3, latent_shift: float = 0.5, force_upcast: bool = False, scaling_factor: float = 1.0, shift_factor: float = 0.0) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_tiny.py#L40) | |
| **매개변수:** | |
| in_channels (`int`, *선택 사항*, 기본값 3) : 입력 이미지의 채널 수. | |
| out_channels (`int`, *선택 사항*, 기본값 3) : 출력의 채널 수. | |
| encoder_block_out_channels (`tuple[int]`, *선택 사항*, 기본값 `(64, 64, 64, 64)`) : 각 인코더 블록의 출력 채널 수를 나타내는 정수 튜플입니다. 튜플의 길이는 인코더 블록의 수와 같아야 합니다. | |
| decoder_block_out_channels (`tuple[int]`, *선택 사항*, 기본값 `(64, 64, 64, 64)`) : 각 decoder block의 출력 채널 수를 나타내는 정수 튜플입니다. 튜플의 길이는 decoder block의 수와 같아야 합니다. | |
| act_fn (`str`, *선택 사항*, 기본값 `"relu"`) : 모델 전체에서 사용할 활성화 함수. | |
| latent_channels (`int`, *선택 사항*, 기본값 4) : 잠재 표현의 채널 수. 잠재 공간은 입력 이미지의 압축된 표현 역할을 합니다. | |
| upsampling_scaling_factor (`int`, *선택 사항*, 기본값 2) : 디코더에서 업샘플링에 사용되는 스케일링 팩터입니다. 업샘플링 과정에서 출력 이미지의 크기를 결정합니다. | |
| num_encoder_blocks (`tuple[int]`, *선택 사항*, 기본값 `(1, 3, 3, 3)`) : 인코딩 과정의 각 단계에서 인코더 블록의 수를 나타내는 정수 튜플입니다. 튜플의 길이는 인코더의 단계 수와 같아야 합니다. 각 단계마다 인코더 블록의 수가 다릅니다. | |
| num_decoder_blocks (`tuple[int]`, *선택 사항*, 기본값 `(3, 3, 3, 1)`) : 디코딩 과정의 각 단계에서 디코더 블록의 수를 나타내는 정수 튜플입니다. 튜플의 길이는 디코더의 단계 수와 같아야 합니다. 각 단계마다 디코더 블록의 수가 다릅니다. | |
| latent_magnitude (`float`, *선택 사항*, 기본값 3.0) : 잠재 표현의 크기입니다. 이 매개변수는 잠재 표현 값을 스케일링하여 정보 보존 범위를 제어합니다. | |
| latent_shift (float, *선택 사항*, 기본값 0.5) : 잠재 표현(latent representation)에 적용되는 시프트(Shift). 이 매개변수는 잠재 공간(latent space)의 중심을 제어합니다. | |
| scaling_factor (`float`, *선택 사항*, 기본값 1.0) : 학습된 잠재 공간의 요소별 표준편차로, 학습 세트의 첫 번째 배치로 계산됩니다. 이는 diffusion model을 학습할 때 잠재 공간의 분산을 1로 스케일링하는 데 사용됩니다. 잠재 변수는 diffusion model에 전달되기 전에 `z = z * scaling_factor` 공식으로 스케일링됩니다. 디코딩 시에는 `z = 1 / scaling_factor * z` 공식으로 원래 스케일로 되돌립니다. 자세한 내용은 [High-Resolution Image Synthesis with Latent Diffusion Models](https://huggingface.co/papers/2112.10752) 논문의 4.3.2절과 D.1절을 참조하세요. 그러나 이 Autoencoder에는 이러한 스케일링 계수가 사용되지 않았으므로 기본값은 1.0입니다. | |
| force_upcast (`bool`, *선택 사항*, 기본값 `False`) : 활성화하면 SD-XL과 같은 고해상도 이미지 파이프라인에서 VAE가 float32로 실행되도록 강제합니다. VAE는 정밀도가 크게 손실되지 않는 범위 내에서 더 낮은 범위로 미세 조정/학습될 수 있으며, 이 경우 `force_upcast`를 `False`로 설정할 수 있습니다(이 fp16 친화적 [AutoEncoder](https://huggingface.co/madebyollin/sdxl-vae-fp16-fix)를 참조). | |
| 이미지를 latent으로 인코딩하고 latent 표현을 이미지로 디코딩하는 작은 distilled VAE 모델입니다. | |
| [AutoencoderTiny](/docs/diffusers/main/ko/api/models/autoencoder_tiny#diffusers.AutoencoderTiny)는 `TAESD`의 원래 구현을 감싸는 래퍼입니다. | |
| 이 모델은 [ModelMixin](/docs/diffusers/main/ko/api/models/overview#diffusers.ModelMixin)에서 상속됩니다. 모든 모델에 대해 구현된 일반적 메서드(다운로드 또는 저장 등)에 대해서는 상위 클래스 문서를 확인하세요. | |
| #### forward[[diffusers.AutoencoderTiny.forward]] | |
| ```python | |
| forward(sample: Tensor, return_dict: bool = True) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_tiny.py#L291) | |
| **매개변수:** | |
| sample (`torch.Tensor`) : 입력 샘플. | |
| return_dict (`bool`, *선택 사항*, 기본값 `True`) : 일반 튜플 대신 `DecoderOutput`를 반환할지 여부. | |
| **반환값:** `DecoderOutput` 또는 `tuple` | |
| `return_dict`가 True이면 `DecoderOutput`가 반환되고, 그렇지 않으면 일반 `tuple`이 반환됩니다. | |
| #### scale_latents[[diffusers.AutoencoderTiny.scale_latents]] | |
| ```python | |
| scale_latents(x: Tensor) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_tiny.py#L156) | |
| raw latents -> [0, 1] | |
| #### unscale_latents[[diffusers.AutoencoderTiny.unscale_latents]] | |
| ```python | |
| unscale_latents(x: Tensor) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_tiny.py#L160) | |
| [0, 1] -> 원시 잠재 변수 | |
| ## AutoencoderTinyOutput[[diffusers.models.autoencoders.autoencoder_tiny.AutoencoderTinyOutput]] | |
| #### diffusers.models.autoencoders.autoencoder_tiny.AutoencoderTinyOutput[[diffusers.models.autoencoders.autoencoder_tiny.AutoencoderTinyOutput]] | |
| ```python | |
| diffusers.models.autoencoders.autoencoder_tiny.AutoencoderTinyOutput(latents: Tensor) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/autoencoders/autoencoder_tiny.py#L28) | |
| **매개변수:** | |
| latents (`torch.Tensor`) : `Encoder`의 인코딩된 출력입니다. | |
| AutoencoderTiny 인코딩 메서드의 출력. | |
Xet Storage Details
- Size:
- 8.02 kB
- Xet hash:
- a5dec463f9fdd25fcc32331464e75df8dd927a6e9866c62f2c6c38b2df7b4c37
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.