Buckets:

mishig's picture
|
download
raw
6.13 kB
# Uzak çıkarım
Uzak çıkarım, çözümleme ve kodlama için yerel üretim gereksinimlerini devretmek üzere bir [Inference Endpoint](https://huggingface.co/docs/inference-endpoints/index)'e erişim sağlar.
## 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)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/remote_utils.py#L190)
**Parametreler:**
endpoint (`str`) : Uzaktan Çözümleme (Remote Decode) için uç nokta.
tensor (`torch.Tensor`) : Çözümlenecek gerginlik (tensor).
processor (`VaeImageProcessor` veya `VideoProcessor`, *isteğe bağlı*) : Video modelleri için `return_type="pt"` ve `return_type="pil"` ile kullanılır.
do_scaling (`bool`, varsayılan `True`, *isteğe bağlı*) : **KULLANIMDI**. **yerine `scaling_factor`/`shift_factor` geçirin.** **seçenek kaldırılana kadar ölçekleme yapılmaması için do_scaling=None/do_scaling=False olarak ayarlayın** `True` olduğunda, örneğin `latents / self.vae.config.scaling_factor` gibi ölçekleme uzaktan uygulanır. `False` ise, girdi ölçekleme uygulanmış olarak geçirilmelidir.
scaling_factor (`float`, *isteğe bağlı*) : Örneğin [`latents / self.vae.config.scaling_factor`](https://github.com/huggingface/diffusers/blob/7007febae5cff000d4df9059d9cf35133e8b2ca9/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L1083C37-L1083C77) şeklinde geçirildiğinde ölçekleme uygulanır. - SD v1: 0.18215 - SD XL: 0.13025 - Flux: 0.3611 `None` ise, girdinin ölçekleme uygulanmış olarak geçirilmesi gerekir.
shift_factor (`float`, *isteğe bağlı*) : Örneğin `latents + self.vae.config.shift_factor` şeklinde iletildiğinde shift uygulanır. - Flux: 0.1159 `None` ise, ölçekleme uygulanmış olarak girdi iletilmelidir.
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"` veya `"jpg"`, varsayılan `jpg`) : `output_type="pil"` ile kullanılır. Uç nokta `jpg` veya `png` döndürür.
partial_postprocess (`bool`, varsayılan `False`) : `output_type="pt"` ile kullanılır. `partial_postprocess=False` durumunda tensor `float16` veya `bfloat16` tipindedir ve normalleştirme işlemi uygulanmaz. `partial_postprocess=True` durumunda tensor `uint8` tipindedir ve normalleştirme işlemi uygulanır.
input_tensor_type (`"binary"`, varsayılan `"binary"`) : Tensor aktarım türü.
output_tensor_type (`"binary"`, varsayılan `"binary"`) : Tensor aktarım türü.
height (`int`, **isteğe bağlı**) : `"packed"` latentler için zorunludur.
width (`int`, **isteğe bağlı**) : `"packed"` latentler için zorunludur.
**Dönüş:**
output (`Image.Image` veya `list[Image.Image]` veya `bytes` veya `torch.Tensor`).
VAE çözümlemesini uzaktan çalıştırmaya olanak tanıyan Hugging Face Hibrit Çıkarım.
## 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)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/utils/remote_utils.py#L382)
**Parametreler:**
endpoint (`str`) : Uzaktan Çözümleme (Remote Decode) için uç nokta.
image (`torch.Tensor` veya `PIL.Image.Image`) : Kodlanacak görüntü.
scaling_factor (`float`, *isteğe bağlı*) : Örneğin `latents * self.vae.config.scaling_factor` şeklinde geçirildiğinde ölçekleme uygulanır. - SD v1: 0.18215 - SD XL: 0.13025 - Flux: 0.3611 `None` ise, girdinin ölçekleme uygulanmış olarak geçirilmesi gerekir.
shift_factor (`float`, *isteğe bağlı*) : Örneğin `latents - self.vae.config.shift_factor` şeklinde geçirildiğinde kaydırma uygulanır. - Flux: 0.1159 `None` ise, ölçekleme uygulanmış olarak girdi geçirilmelidir.
**Dönüş:**
output (`torch.Tensor`).
VAE kodlamayı uzaktan çalıştırmaya izin veren Hugging Face Hibrit Çıkarım.

Xet Storage Details

Size:
6.13 kB
·
Xet hash:
a3766d8872de12028e6c9fb849b132bbc42bae1fc878049401b7fa21542eb9cd

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