(
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,
)
| 58 | |
| 59 | |
| 60 | def check_inputs_decode( |
| 61 | endpoint: str, |
| 62 | tensor: "torch.Tensor", |
| 63 | processor: "VaeImageProcessor" | "VideoProcessor" | None = None, |
| 64 | do_scaling: bool = True, |
| 65 | scaling_factor: float | None = None, |
| 66 | shift_factor: float | None = None, |
| 67 | output_type: Literal["mp4", "pil", "pt"] = "pil", |
| 68 | return_type: Literal["mp4", "pil", "pt"] = "pil", |
| 69 | image_format: Literal["png", "jpg"] = "jpg", |
| 70 | partial_postprocess: bool = False, |
| 71 | input_tensor_type: Literal["binary"] = "binary", |
| 72 | output_tensor_type: Literal["binary"] = "binary", |
| 73 | height: int | None = None, |
| 74 | width: int | None = None, |
| 75 | ): |
| 76 | if tensor.ndim == 3 and height is None and width is None: |
| 77 | raise ValueError("`height` and `width` required for packed latents.") |
| 78 | if ( |
| 79 | output_type == "pt" |
| 80 | and return_type == "pil" |
| 81 | and not partial_postprocess |
| 82 | and not isinstance(processor, (VaeImageProcessor, VideoProcessor)) |
| 83 | ): |
| 84 | raise ValueError("`processor` is required.") |
| 85 | if do_scaling and scaling_factor is None: |
| 86 | deprecate( |
| 87 | "do_scaling", |
| 88 | "1.0.0", |
| 89 | "`do_scaling` is deprecated, pass `scaling_factor` and `shift_factor` if required.", |
| 90 | standard_warn=False, |
| 91 | ) |
| 92 | |
| 93 | |
| 94 | def postprocess_decode( |
no test coverage detected
searching dependent graphs…