[Bugfix] Reject empty prompts in Flux2 Klein diffusion pipeline (#3711)
Signed-off-by: MmMaiIIi <2360655509@qq.com> Co-authored-by: WeiQing Chen <40507679+david6666666@users.noreply.github.com>
This commit is contained in:
1 parent
1fa734419e
commit
3ac739817f
2 files changed
+84
No files matched your search
@@ -701,6 +701,10 @@ class Flux2KleinPipeline(nn.Module, CFGParallelMixin, SupportImageInput, Diffusi
|
||||
raise ValueError(
|
||||
"Provide either `prompt` or `prompt_embeds`. Cannot leave both `prompt` and `prompt_embeds` undefined."
|
||||
)
|
||||
elif isinstance(prompt, str) and not prompt.strip():
|
||||
raise ValueError("`prompt` cannot be empty or whitespace-only.")
|
||||
elif isinstance(prompt, list) and any(isinstance(p, str) and not p.strip() for p in prompt):
|
||||
raise ValueError("`prompt` cannot contain empty or whitespace-only strings.")
|
||||
elif prompt is not None and (not isinstance(prompt, str) and not isinstance(prompt, list)):
|
||||
raise ValueError(f"`prompt` has to be of type `str` or `list` but is {type(prompt)}")
|
||||
|
||||
|
||||
Reference in new issue
Block a user