Buckets:
원격 추론
Remote inference는 디코딩 및 인코딩을 위한 로컬 생성 요구 사항을 오프로드하기 위해 Inference Endpoint에 대한 액세스를 제공합니다.
remote_decode[[diffusers.utils.remote_decode]]
diffusers.utils.remote_decode[[diffusers.utils.remote_decode]]
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)
매개변수:
endpoint (str) : Remote Decode 엔드포인트입니다.
tensor (torch.Tensor) : 디코딩할 텐서.
processor (VaeImageProcessor 또는 VideoProcessor, 선택 사항) : return_type="pt" 및 Video 모델의 return_type="pil"과 함께 사용됩니다.
do_scaling (bool, 기본값 True, 선택 사항) : 비추천. 대신 scaling_factor/shift_factor를 전달하세요. 옵션이 제거될 때까지 스케일링을 하지 않으려면 do_scaling=None/do_scaling=False를 설정하세요 True인 경우 latents / self.vae.config.scaling_factor와 같은 스케일링이 원격으로 적용됩니다. False인 경우, 스케일링이 적용된 상태로 입력을 전달해야 합니다.
scaling_factor (float, 선택 사항) : 전달 시 스케일링이 적용됩니다. 예: latents / self.vae.config.scaling_factor. - SD v1: 0.18215 - SD XL: 0.13025 - Flux: 0.3611 None인 경우, 스케일링이 적용된 상태로 입력을 전달해야 합니다.
shift_factor (float, 선택 사항) : 전달 시 shift가 적용됩니다. 예: latents + self.vae.config.shift_factor. - Flux: 0.1159 None인 경우, scaling이 적용된 상태로 입력을 전달해야 합니다.
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 postprocesseduint8image tensor. Recommendations:"pt"withpartial_postprocess=Trueis the smallest transfer for full quality."pt"withpartial_postprocess=Falseis the most compatible with third party code."pil"withimage_format="jpg"` is the smallest transfer overall.
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이며, 비정규화(denormalization)되지 않은 상태입니다. partial_postprocess=True인 경우 텐서는 uint8이며, 비정규화된 상태입니다.
input_tensor_type ("binary", 기본값 "binary") : Tensor 전송 유형.
output_tensor_type ("binary", 기본값 "binary") : Tensor 전송 유형.
height (int, 선택 사항) : "packed" latents에 필요합니다.
width (int, 선택 사항) : "packed" latents에 필요합니다.
반환값:
output (Image.Image 또는 list[Image.Image] 또는 bytes 또는 torch.Tensor).
VAE 디코딩을 원격으로 실행할 수 있는 Hugging Face 하이브리드 추론
remote_encode[[diffusers.utils.remote_utils.remote_encode]]
diffusers.utils.remote_utils.remote_encode[[diffusers.utils.remote_utils.remote_encode]]
diffusers.utils.remote_utils.remote_encode(endpoint: str, image: 'torch.Tensor' | Image.Image, scaling_factor: float | None = None, shift_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, 선택 사항) : 전달 시 shift가 적용됩니다. 예: latents - self.vae.config.shift_factor. - Flux: 0.1159 None인 경우, scaling이 적용된 상태로 입력을 전달해야 합니다.
반환값:
output (torch.Tensor).
VAE 인코딩을 원격으로 실행할 수 있는 Hugging Face 하이브리드 추론
Xet Storage Details
- Size:
- 6.21 kB
- Xet hash:
- e7ce1fb075a6849ec47ccf31469f5b9c524b3fafd42b894acce06ef60c812b05
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.