Skip to content

Could we make BaseOutput picklable? #3327

@larme

Description

@larme

Currently we can pickle but cannot recover from the pickled bytes:

In [40]: bs =pickle.dumps(output)

In [41]: pickle.loads(bs)
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:1                                                                                    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: IFPipelineOutput.__init__() missing 3 required positional arguments: 'images', 'nsfw_detected', and 'watermark_detected'

The motive is that we want to pass outputs of pipelines between processes or even machines. We can use to_tuple but user will need to know the order of different outputs' keys to use the returned tuples.

System Info

  • diffusers version: 0.16.1
  • Platform: debian 11
  • Python version: 3.10.6
  • PyTorch version (GPU?): 2.0 (True)
  • Using distributed or parallel set-up in script?: True

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleIssues that haven't received updates

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions