Buckets:
| # Inferensi jarak jauh | |
| Remote inference menyediakan akses ke [Inference Endpoint](https://huggingface.co/docs/inference-endpoints/index) untuk mengalihkan kebutuhan generasi lokal untuk decoding dan encoding. | |
| ## remote_decode[[diffusers.utils.remote_decode]] | |
| #### diffusers.utils.remote_decode[[diffusers.utils.remote_decode]] | |
| ```python | |
| diffusers.utils.remote_decode(endpoint: str, tensor: 'torch.Tensor', processor: 'VaeImageProcessor' | 'VideoProcessor' | None = None, do_scaling: bool = True, scaling_factor: float | None = None, shift_factor: float | None = None, output_type: Literal['mp4', 'pil', 'pt'] = 'pil', return_type: Literal['mp4', 'pil', 'pt'] = 'pil', image_format: Literal['png', 'jpg'] = 'jpg', partial_postprocess: bool = False, input_tensor_type: Literal['binary'] = 'binary', output_tensor_type: Literal['binary'] = 'binary', height: int | None = None, width: int | None = None) | |
| ``` | |
| [Sumber](https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/remote_utils.py#L190) | |
| **Parameter:** | |
| endpoint (`str`) : Endpoint untuk Remote Decode. | |
| tensor (`torch.Tensor`) : Tensor yang akan didekode. | |
| processor (`VaeImageProcessor` atau `VideoProcessor`, *opsional*) : Digunakan dengan `return_type="pt"`, dan `return_type="pil"` untuk model Video. | |
| do_scaling (`bool`, default `True`, *opsional*) : **DEPRECATED**. **gunakan `scaling_factor`/`shift_factor` sebagai gantinya.** **masih tetapkan do_scaling=None/do_scaling=False untuk tanpa scaling sampai opsi dihapus** Ketika `True` scaling, misalnya `latents / self.vae.config.scaling_factor`, diterapkan secara remote. Jika `False`, input harus diteruskan dengan scaling yang sudah diterapkan. | |
| scaling_factor (`float`, *opsional*) : Scaling diterapkan ketika di-pass, misalnya [`latents / self.vae.config.scaling_factor`](https://github.com/huggingface/diffusers/blob/7007febae5cff000d4df9059d9cf35133e8b2ca9/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L1083C37-L1083C77). - SD v1: 0.18215 - SD XL: 0.13025 - Flux: 0.3611 Jika `None`, input harus di-pass dengan scaling yang sudah diterapkan. | |
| shift_factor (`float`, *opsional*) : Shift diterapkan ketika di-pass, misalnya `latents + self.vae.config.shift_factor`. - Flux: 0.1159 Jika `None`, input harus di-pass dengan scaling yang sudah diterapkan. | |
| output_type (`"mp4"` or `"pil"` or `"pt", default `"pil") : **Endpoint** output type. Subject to change. Report feedback on preferred type. `"mp4": Supported by video models. Endpoint returns `bytes` of video. `"pil"`: Supported by image and video models. Image models: Endpoint returns `bytes` of an image in `image_format`. Video models: Endpoint returns `torch.Tensor` with partial `postprocessing` applied. Requires `processor` as a flag (any `None` value will work). `"pt"`: Support by image and video models. Endpoint returns `torch.Tensor`. With `partial_postprocess=True` the tensor is postprocessed `uint8` image tensor. Recommendations: `"pt"` with `partial_postprocess=True` is the smallest transfer for full quality. `"pt"` with `partial_postprocess=False` is the most compatible with third party code. `"pil"` with `image_format="jpg"` is the smallest transfer overall. | |
| return_type (`"mp4"` or `"pil"` or `"pt", default `"pil") : **Function** return type. `"mp4": Function returns `bytes` of video. `"pil"`: Function returns `PIL.Image.Image`. With `output_type="pil" no further processing is applied. With `output_type="pt" a `PIL.Image.Image` is created. `partial_postprocess=False` `processor` is required. `partial_postprocess=True` `processor` is **not** required. `"pt"`: Function returns `torch.Tensor`. `processor` is **not** required. `partial_postprocess=False` tensor is `float16` or `bfloat16`, without denormalization. `partial_postprocess=True` tensor is `uint8`, denormalized. | |
| image_format (`"png"` atau `"jpg"`, default `jpg`) : Digunakan dengan `output_type="pil"`. Endpoint mengembalikan `jpg` atau `png`. | |
| partial_postprocess (`bool`, default `False`) : Digunakan dengan `output_type="pt"`. `partial_postprocess=False` tensor adalah `float16` atau `bfloat16`, tanpa denormalisasi. `partial_postprocess=True` tensor adalah `uint8`, dinormalisasi. | |
| input_tensor_type (`"binary"`, default `"binary"`) : Jenis transfer Tensor. | |
| output_tensor_type (`"binary"`, default `"binary"`) : Jenis transfer Tensor. | |
| height (`int`, **opsional**) : Diperlukan untuk latens `"packed"`. | |
| width (`int`, **opsional**) : Diperlukan untuk latens `"packed"`. | |
| **Mengembalikan:** | |
| output (`Image.Image` atau `list[Image.Image]` atau `bytes` atau `torch.Tensor`). | |
| Hugging Face Hybrid Inference yang memungkinkan eksekusi decode VAE secara jarak jauh. | |
| ## remote_encode[[diffusers.utils.remote_utils.remote_encode]] | |
| #### diffusers.utils.remote_utils.remote_encode[[diffusers.utils.remote_utils.remote_encode]] | |
| ```python | |
| diffusers.utils.remote_utils.remote_encode(endpoint: str, image: 'torch.Tensor' | Image.Image, scaling_factor: float | None = None, shift_factor: float | None = None) | |
| ``` | |
| [Sumber](https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/remote_utils.py#L382) | |
| **Parameter:** | |
| endpoint (`str`) : Endpoint untuk Remote Decode. | |
| image (`torch.Tensor` atau `PIL.Image.Image`) : Gambar yang akan dikodekan. | |
| scaling_factor (`float`, *opsional*) : Skala diterapkan saat di-pass, misalnya `latents * self.vae.config.scaling_factor`. - SD v1: 0.18215 - SD XL: 0.13025 - Flux: 0.3611 Jika `None`, input harus di-pass dengan skala yang sudah diterapkan. | |
| shift_factor (`float`, *opsional*) : Shift diterapkan ketika diberikan, misalnya `latents - self.vae.config.shift_factor`. - Flux: 0.1159 Jika `None`, input harus diberikan dengan scaling yang sudah diterapkan. | |
| **Mengembalikan:** | |
| output (`torch.Tensor`). | |
| Hugging Face Hybrid Inference yang memungkinkan ekode VAE dijalankan secara jarak jauh. | |
Xet Storage Details
- Size:
- 5.85 kB
- Xet hash:
- a1228c452f82992f23e92966eea143b7ccc42f19130c39420748c0267217bbc9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.