Diffusers documentation

リモート推論

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

リモート推論

Remote inference は、デコードおよびエンコードのためのローカルでの生成要件をオフロードするために、Inference Endpoint へのアクセスを提供します。

remote_decode

diffusers.utils.remote_decode

< >

( endpoint: strtensor: 'torch.Tensor'processor: 'VaeImageProcessor' | 'VideoProcessor' | None = Nonedo_scaling: bool = Truescaling_factor: float | None = Noneshift_factor: float | None = Noneoutput_type: Literal['mp4', 'pil', 'pt'] = 'pil'return_type: Literal['mp4', 'pil', 'pt'] = 'pil'image_format: Literal['png', 'jpg'] = 'jpg'partial_postprocess: bool = Falseinput_tensor_type: Literal['binary'] = 'binary'output_tensor_type: Literal['binary'] = 'binary'height: int | None = Nonewidth: int | None = None )

パラメータ

  • endpoint (str) — Remote Decode のエンドポイント。
  • tensor (torch.Tensor) — デコード対象のテンソル。
  • processor(VaeImageProcessor または VideoProcessor、任意)— return_type="pt" と、Video モデルでは return_type="pil" と組み合わせて使用します。
  • do_scaling (bool, default True, optional) — DEPRECATED. pass scaling_factor/shift_factor instead. still set do_scaling=None/do_scaling=False for no scaling until option is removed When True scaling e.g. latents / self.vae.config.scaling_factor is applied remotely. If False, input must be passed with scaling applied.
  • scaling_factor (float, 省略可) — 例: latents / self.vae.config.scaling_factor.
    • SD v1: 0.18215
    • SD XL: 0.13025
    • Flux: 0.3611 Noneの場合、スケーリングを適用した入力を渡す必要があります。
  • shift_factor (float, 省略可) — 渡された場合、シフトが適用されます。例: latents + self.vae.config.shift_factor.
    • Flux: 0.1159 Noneの場合、スケーリングを適用した入力を渡す必要があります。
  • 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 bytesof video.“pil”: Supported by image and video models. Image models: Endpoint returns bytesof an image inimage_format. Video models: Endpoint returns torch.Tensorwith partialpostprocessingapplied. Requiresprocessoras a flag (anyNonevalue will work).“pt”: Support by image and video models. Endpoint returns torch.Tensor. With partial_postprocess=Truethe tensor is postprocesseduint8` image tensor.

    推奨事項: "pt"にpartial_postprocess=Trueを指定すると、フル品質で最小の転送になります。"pt"に partial_postprocess=Falseを指定すると、サードパーティ製コードとの互換性が最高になります。"pil"に image_format="jpg"を指定すると、全体として最小の転送になります。

  • return_type ("mp4" or "pil" or "pt", default “pil”) — Function return type.

    "mp4": Function returns bytesof video.“pil”: Function returns PIL.Image.Image. With output_type=“pil” no further processing is applied. With output_type="pt" a PIL.Image.Imageis created.partial_postprocess=False processoris required.partial_postprocess=True processoris **not** required.“pt”: Function returns torch.Tensor. processoris **not** required.partial_postprocess=Falsetensor isfloat16orbfloat16, without denormalization. partial_postprocess=Truetensor isuint8`, denormalized.

  • image_format ("png" または "jpg"、デフォルトは jpg) — output_type="pil" と併せて使用します。エンドポイントは jpg または png を返します。
  • partial_postprocess (bool、デフォルト False) — output_type="pt" と併せて使用します。partial_postprocess=False の場合、テンソルはfloat16またはbfloat16で、デノーマライズされていません。partial_postprocess=True の場合、テンソルはuint8で、デノーマライズされています。
  • input_tensor_type ("binary"、デフォルトは "binary") — テンソル転送タイプ。
  • output_tensor_type ("binary"、デフォルトは "binary") — テンソルの転送タイプ。
  • height (int、任意) — "packed" 形式の潜在変数には必須です。
  • width (int、任意) — "packed" 形式の潜在変数には必須です。

VAEのデコードをリモートで実行できるHugging Face Hybrid Inference。

remote_encode

diffusers.utils.remote_utils.remote_encode

< >

( endpoint: strimage: 'torch.Tensor' | Image.Imagescaling_factor: float | None = Noneshift_factor: float | None = None )

パラメータ

  • endpoint (str) — Remote Decode のエンドポイント。
  • image (torch.Tensor または PIL.Image.Image) — エンコードする画像。
  • scaling_factor (float, 省略可) — 例: latents * self.vae.config.scaling_factor.
    • SD v1: 0.18215
    • SD XL: 0.13025
    • Flux: 0.3611 Noneの場合、スケーリングを適用した入力を渡す必要があります。
  • shift_factor (float, 省略可) — 指定された場合、シフトが適用されます。例: latents - self.vae.config.shift_factor.
    • Flux: 0.1159 Noneの場合、スケーリングを適用した入力を渡す必要があります。

VAEエンコードをリモートで実行できるHugging Face Hybrid Inference。

Update on GitHub