Skip to content
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

flux: make scheduler config params optional #10384

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vladmandic
Copy link
Contributor

@vladmandic vladmandic commented Dec 25, 2024

now that we have flow support for most of the schedulers, we really should not rely on hardcoded optional scheduler config values inside the pipeline - they should be optional.

without this change, flux pipeline will fail for most non-default schedulers (with flow mode enabled) due to missing config value.

note that this change needs to be mirrored for all flux pipelines, but due to how diffusers ci works, i'm really not sure what needs to be manually updated vs not.

@hlky @yiyixuxu

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Comment on lines +77 to +94
base_seq_len: Optional[int] = 256,
max_seq_len: Optional[int] = 4096,
base_shift: Optional[float] = 0.5,
max_shift: Optional[float] = 1.16,
scheduler: Optional[FlowMatchEulerDiscreteScheduler] = None,
):
if base_seq_len or max_seq_len or base_shift or max_shift or scheduler is None:
deprecation_message = "Pass `scheduler` to `calculate_shift`."
deprecate(
"calculate_shift scheduler",
"1.0.0",
deprecation_message,
standard_warn=False,
)
base_seq_len = base_seq_len or scheduler.config.get("base_image_seq_len", 256)
max_seq_len = max_seq_len or scheduler.config.get("max_image_seq_len", 4096)
base_shift = base_shift or scheduler.config.get("base_shift", 0.5)
max_shift = max_shift or scheduler.config.get("max_shift", 1.16)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @vladmandic, it will be fun to try to those scheduler changes with Flux.

As you mentioned CI, I've ran make fix-copies to demonstrate. Every occurrence of # Copied from diffusers.pipelines.flux.pipeline_flux.calculate_shift is updated, this highlights the effects in our own codebase, we'll need to update the call of calculate_shift in every pipeline and there can be effects downstream, so I've pushed this version which adds a deprecation message. We'll run make fix-copies again when the changes here are finalised.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants