Skip to content

Running other pipelines #25

@irgolic

Description

@irgolic

In #23 I tried to implement running an arbitrary HuggingFace pipeline as it gets published in e.g. https://github.com/huggingface/diffusers/tree/main/examples/community.

I added a way to set the name of the pipeline to be constructed (referencing e.g., a community published pipeline), and the name of the method to be called on it (None referring to __call__, otherwise usually either text2img, img2img and inpaint).

Extra parameters were also allowed. I got to the point where arbitrary arguments could be passed to the pipe(**kwargs) call:

  • by GET /pipeline?query1=a&query2=b, arbitrary query strings were parsed by ast.literal_eval, able to express primitive types like strings, bytes, numbers, and even collections like tuples, lists, dicts
  • POST /task took an extra_parameters dict, able to express any JSON (string, number, boolean, list, dict)

However, this would still mean no way of calling most of the community pipelines.

  • CLIP-guided pipeline doesn't take negative_prompt, which is defined in our defaults
  • Composable pipeline would work I think; the only difference is that it allows a token1 | token2 syntax
  • Interpolate pipeline saves them into files and returns string, which won't work without writing extra code to support handing those over to the caller
  • Speech to image pipeline takes an untyped audio argument (probably some sort of blob), which can't be easily represented by the types expressable by ast.literal_eval and JSON
  • Wildcard pipeline would probably work by providing wildcard_option_dict along with a __clothing__ syntaxed prompt
  • Mega pipeline is the one used by default
  • LPW pipeline is the one we should switch the default to, does everything mega does plus supports (token:1.3) syntax and longer prompts

Essentially, with #23 you would profit composable and wildcard pipeline. The truth is, I would prefer to allow all of these syntaxes at the same time, but the pipeline definitions aren't composable with one another (a gripe shared by others huggingface/diffusers#841).

Is there some other way to run arbitrary pipelines via API? What changes would we need to make to get there?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions