-
Notifications
You must be signed in to change notification settings - Fork 4
Description
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 byast.literal_eval, able to express primitive types like strings, bytes, numbers, and even collections like tuples, lists, dicts POST /tasktook anextra_parametersdict, 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 | token2syntax - 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
audioargument (probably some sort of blob), which can't be easily represented by the types expressable byast.literal_evaland JSON - Wildcard pipeline would probably work by providing
wildcard_option_dictalong 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?