diffusers
diffusers copied to clipboard
API: move pipeline's `output_type` to its Output object
Now that Pipelines return a well-defined PipelineOutput object, I suggest something along the lines of
class StableDiffusionPipelineOutput:
def images(self) -> List[PIL.Image.Image]: # […]
def as_array(self) -> np.ndarray: # […]
That retains the functionality of having PIL Image support built-in to diffusers while also making the return types unambiguous.
Hey @keturn that's an interesting idea! The problem though is that we have to maintain backward compatibility with the tuples tensor, so tuples[0]
output has to match StableDiffusionPipelineOutput[0]
.
We could deprecate the output_type
function argument and maybe just add a new .images_array
variable?
Also cc @anton-l @patil-suraj
Agree with @patrickvonplaten regarding the matching tuples, but returning a PIL image by default won't work either (ONNX restriction to only have lists or tensors in the output).
But having an as_pil()
function in the dataclass instead could work, although breaking the "returning PIL by default" design.
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.