[Misc] Build canonical image task prompts (#6049)
Signed-off-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
1 parent
58007c0084
commit
8b0a6779d4
14 files changed
+188
-266
No files matched your search
@@ -3,32 +3,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
def build_text_to_image_prompt(
|
||||
prompt: str,
|
||||
negative_prompt: str | None,
|
||||
height: int | None = None,
|
||||
width: int | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Build a Cosmos3 T2I prompt by selecting image output modality.
|
||||
|
||||
Cosmos3 uses the same pipeline class for T2I and video modes. The OpenAI
|
||||
image endpoint selects T2I by adding ``modalities=["image"]``. ``height``
|
||||
and ``width`` are accepted for registry compatibility; sizing travels
|
||||
through sampling params instead of the prompt payload.
|
||||
"""
|
||||
del height, width
|
||||
text_prompt: dict[str, Any] = {
|
||||
"prompt": prompt,
|
||||
"modalities": ["image"],
|
||||
}
|
||||
if negative_prompt is not None:
|
||||
text_prompt["negative_prompt"] = negative_prompt
|
||||
return text_prompt
|
||||
|
||||
|
||||
COSMOS3_EXTRA_BODY_PARAMS = frozenset(
|
||||
{
|
||||
"flow_shift",
|
||||
|
||||
Reference in new issue
Block a user