-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support multi prompts #96
Conversation
@pythias I did not know that p.prompt could be a list. Thanks for letting me know. If you don't mind, could you please tell me the specific operation of the case where p.prompt becomes a list? Because I would like to see what problems the existing implementation causes and how it can be improved with this PR. |
@ototadana When I want to generate multiple styles in one api request, like the script '/stable-diffusion-webui/scripts/prompt_matrix.py' |
@pythias I apologize for my lack of understanding. Am I correct in understanding that this is a case of API calls only, not UI operations? And that you want to apply different prompts to each of the generated images? If this understanding is correct, could you give me an example of a request for an API call, if you don't mind? I am quite interested in such a use case and would like to study it. (If this understanding is incorrect and could happen with UI operations, I would like to know the actual operation.) Thank you. |
@ototadana You can call like this params curl -X POST -H "Content-Type: application/json" 'https://127.0.0.1:7860/sdapi/v1/txt2img' -d '{"prompt":"winter|spring","script_name":"prompt matrix","script_args":[true,true,"positive","comma",10]}' However, since the number of images returned by the face editor is twice the original number, it caused an error ( 谢谢你 |
In the extension I wrote, this is how I used it. I wrapped the original SD interface. When there are multiple style requests in the interface, I would modify the 'prompt' attribute in the StableDiffusionProcessing object. def apply_multi_process(p: StableDiffusionProcessing):
prompts = to_multi_prompts(p.prompt)
if len(prompts) == 1:
return
processing.fix_seed(p)
same_seed = get_extra_value(p, 'same-seed', False)
p.prompt = prompts
p.batch_size = 1
p.n_iter = len(p.prompt)
p.seed = [p.seed + (0 if same_seed else i) for i in range(len(p.prompt))] |
@pythias What do you think of the following modification to the proc_images function? if type(p.prompt) == list:
p.prompt = p.prompt[i]
proc = self.proc_image(p, option, image) If there is no problem with such a modification, I would be willing to implement a modification based on this on my end after merging this PR. (I'm thinking of perhaps a slightly pessimistic implementation that would work even if
Thank you. This is another issue. We will be adding new options to address this. |
@ototadana |
@pythias |
p.prompt is list|str