Fix: Cosmos2.5 Video2World frame extraction and add default negative prompt by adi776borate · Pull Request #13018 · huggingface/diffusers · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 39 additions & 6 deletions src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_predict.py
10 changes: 9 additions & 1 deletion src/diffusers/pipelines/cosmos/pipeline_cosmos2_text2image.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ def __init__(self, *args, **kwargs):

logger = logging.get_logger(__name__) # pylint: disable=invalid-name

DEFAULT_NEGATIVE_PROMPT = (
"The video captures a series of frames showing ugly scenes, static with no motion, motion blur, "
"over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, "
"underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, "
"jerky movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, "
"fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. "
"Overall, the video is of poor quality."
)

EXAMPLE_DOC_STRING = """
Examples:
Expand Down Expand Up @@ -300,7 +308,7 @@ def encode_prompt(
prompt_embeds = prompt_embeds.view(batch_size * num_images_per_prompt, seq_len, -1)

if do_classifier_free_guidance and negative_prompt_embeds is None:
negative_prompt = negative_prompt or ""
negative_prompt = negative_prompt if negative_prompt is not None else DEFAULT_NEGATIVE_PROMPT
negative_prompt = batch_size * [negative_prompt] if isinstance(negative_prompt, str) else negative_prompt

if prompt is not None and type(prompt) is not type(negative_prompt):
Expand Down
10 changes: 9 additions & 1 deletion src/diffusers/pipelines/cosmos/pipeline_cosmos2_video2world.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ def __init__(self, *args, **kwargs):

logger = logging.get_logger(__name__) # pylint: disable=invalid-name

DEFAULT_NEGATIVE_PROMPT = (
"The video captures a series of frames showing ugly scenes, static with no motion, motion blur, "
"over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, "
"underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, "
"jerky movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, "
"fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. "
"Overall, the video is of poor quality."
)

EXAMPLE_DOC_STRING = """
Examples:
Expand Down Expand Up @@ -319,7 +327,7 @@ def encode_prompt(
prompt_embeds = prompt_embeds.view(batch_size * num_videos_per_prompt, seq_len, -1)

if do_classifier_free_guidance and negative_prompt_embeds is None:
negative_prompt = negative_prompt or ""
negative_prompt = negative_prompt if negative_prompt is not None else DEFAULT_NEGATIVE_PROMPT
negative_prompt = batch_size * [negative_prompt] if isinstance(negative_prompt, str) else negative_prompt

if prompt is not None and type(prompt) is not type(negative_prompt):
Expand Down
10 changes: 9 additions & 1 deletion src/diffusers/pipelines/cosmos/pipeline_cosmos_text2world.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ def __init__(self, *args, **kwargs):

logger = logging.get_logger(__name__) # pylint: disable=invalid-name

DEFAULT_NEGATIVE_PROMPT = (
"The video captures a series of frames showing ugly scenes, static with no motion, motion blur, "
"over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, "
"underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, "
"jerky movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, "
"fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. "
"Overall, the video is of poor quality."
)

EXAMPLE_DOC_STRING = """
Examples:
Expand Down Expand Up @@ -285,7 +293,7 @@ def encode_prompt(
prompt_embeds = prompt_embeds.view(batch_size * num_videos_per_prompt, seq_len, -1)

if do_classifier_free_guidance and negative_prompt_embeds is None:
negative_prompt = negative_prompt or ""
negative_prompt = negative_prompt if negative_prompt is not None else DEFAULT_NEGATIVE_PROMPT
negative_prompt = batch_size * [negative_prompt] if isinstance(negative_prompt, str) else negative_prompt

if prompt is not None and type(prompt) is not type(negative_prompt):
Expand Down
10 changes: 9 additions & 1 deletion src/diffusers/pipelines/cosmos/pipeline_cosmos_video2world.py
Loading