Skip to content

fix(flux): decouple modular flux from classic and qwenimage imports#13958

Open
akshan-main wants to merge 3 commits into
huggingface:mainfrom
akshan-main:fix-flux-modular-coupling
Open

fix(flux): decouple modular flux from classic and qwenimage imports#13958
akshan-main wants to merge 3 commits into
huggingface:mainfrom
akshan-main:fix-flux-modular-coupling

Conversation

@akshan-main

@akshan-main akshan-main commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Addresses Issue 6 of the flux review (#13584). The modular Flux blocks imported FluxPipeline._pack_latents and _prepare_latent_image_ids, the classic Kontext PREFERRED_KONTEXT_RESOLUTIONS constant, and two QwenImage modular helpers. This replaces those cross-imports with flux-modular-local copies, following decoders.py.

The coupling check from the issue returns nothing and the modular flux tests pass.

Fixes #13584

Before submitting

Who can review?

@DN6 @sayakpaul @yiyixuxu

@github-actions github-actions Bot added modular-pipelines size/M PR with diff < 200 LOC labels Jun 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi @akshan-main, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Fixes #1234) to the PR description so the issue is linked. See the contribution guide for more details. If this PR intentionally does not fix a tracked issue, a maintainer can add the no-issue-needed label to silence this reminder.

@sayakpaul sayakpaul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry I don't get it. What's the problem with the existing imports? These assumed that the modular pipelines were implemented w.r.t their standard counterparts. @yiyixuxu am I missing something?

@akshan-main

akshan-main commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Sorry I don't get it. What's the problem with the existing imports? These assumed that the modular pipelines were implemented w.r.t their standard counterparts. @yiyixuxu am I missing something?

Hey!
This came from issue 6 of the flux review (#13584), which explicitly flagged these and pointed to decoders.py keeping its helper local. #13708 independently did the same decoupling into a flux-local pipeline_helpers.py and even added a test asserting modular flux doesn't import from ...pipelines or ..qwenimage, so it wasn't just my reading.

You're right the standard-counterpart imports are the normal pattern (qwenimage, flux2, all do it), so the FluxPipeline and Kontext ones are fine. The one I'd still flag is flux/inputs.py importing from ..qwenimage, the only cross-family import in modular_pipelines. I can narrow this to just that, or close it if you and @yiyixuxu prefer it all as-is.

@yiyixuxu

Copy link
Copy Markdown
Collaborator

Sorry I don't get it. What's the problem with the existing imports? These assumed that the modular pipelines were implemented w.r.t their standard counterparts. @yiyixuxu am I missing something?

ohh, I agree with the agent review that it should not cross-import here because modular vs standard is a parallel relationship, #Copied from would be better if it works, but the PR fix seems ok too

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


def _pack_latents(latents, batch_size, num_channels_latents, height, width):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's try using "# Copied from ..."?

@sayakpaul sayakpaul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's try using "# Copied from ..." where possible?

@akshan-main

Copy link
Copy Markdown
Contributor Author

Let's try using "# Copied from ..." where possible?

the two qwenimage modular helpers now use # Copied from

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flux model/pipeline review

3 participants